diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2025-04-25 08:01:32 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2025-05-16 08:54:13 +0200 |
commit | 78f8c6c81c2e900aa1cb433940667a054cc0b6ed (patch) | |
tree | b03c5c96e1d45645a5528d2007f343f21bd46f48 | |
parent | 1f737463587fec21337631bc0320718b49fde26c (diff) |
buffer flush
34 files changed, 331 insertions, 342 deletions
diff --git a/api/plugin-support.hpp b/api/plugin-support.hpp index 4300da18..77160040 100644 --- a/api/plugin-support.hpp +++ b/api/plugin-support.hpp @@ -17,6 +17,7 @@ #include <QDebug> #include <QString> +#include <QtCore5Compat/QStringRef> #include <QLibrary> #include <QDir> #include <QIcon> @@ -159,7 +160,7 @@ private: for (auto name : names) { if (in.startsWith(name)) - return in.mid(std::strlen(name)).toString(); + return in.mid((int)std::strlen(name)).toString(); } } } diff --git a/cmake/msvc.cmake b/cmake/msvc.cmake index b390c120..b9505896 100644 --- a/cmake/msvc.cmake +++ b/cmake/msvc.cmake @@ -64,6 +64,8 @@ function(sets type) endwhile() endfunction() +set(OpenCV_STATIC 1) + if(CMAKE_PROJECT_NAME STREQUAL "opentrack") #include("${CMAKE_CURRENT_LIST_DIR}/opentrack-policy.cmake" NO_POLICY_SCOPE) @@ -103,6 +105,9 @@ if(CMAKE_PROJECT_NAME STREQUAL "OpenCV") set(BUILD_PERF_TESTS OFF) set(BUILD_opencv_apps OFF) set(BUILD_opencv_gapi OFF) + + set(OPENCV_SKIP_MSVC_PARALLEL 1) + set(OPENCV_DISABLE_THREAD_SUPPORT 1) endif() if(CMAKE_PROJECT_NAME STREQUAL "TestOscpack") @@ -113,9 +118,10 @@ set(opentrack-simd "SSE2") if(CMAKE_PROJECT_NAME STREQUAL "onnxruntime") sets(BOOL - ONNX_USE_MSVC_STATIC_RUNTIME OFF - protobuf_MSVC_STATIC_RUNTIME OFF - onnxruntime_USE_AVX OFF + ONNX_USE_MSVC_STATIC_RUNTIME ON + protobuf_MSVC_STATIC_RUNTIME ON + ABSL_MSVC_STATIC_RUNTIME ON + onnxruntime_USE_AVX ON onnxruntime_USE_AVX2 OFF onnxruntime_USE_AVX512 OFF onnxruntime_BUILD_BENCHMARKS OFF @@ -130,6 +136,7 @@ if(CMAKE_PROJECT_NAME STREQUAL "onnxruntime") ONNX_GEN_PB_TYPE_STUBS OFF onnxruntime_DISABLE_CONTRIB_OPS ON BUILD_TESTING OFF + BUILD_SHARED_LIBS OFF ) if(opentrack-64bit) sets(BOOL @@ -143,7 +150,7 @@ if(opentrack-64bit) endif() set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL") -add_compile_options(-MD) +add_compile_options(-MT) add_link_options(-cgthreads:1) @@ -162,11 +169,11 @@ set(_CFLAGS_DEBUG "-guard:cf -MTd -Gs0 -RTCs") set(_CXXFLAGS_RELEASE "${_CFLAGS_RELEASE}") set(_CXXFLAGS_DEBUG "${_CFLAGS_DEBUG}") -set(_LDFLAGS "-WX") +set(_LDFLAGS "") set(_LDFLAGS_RELEASE "-OPT:REF,ICF=10 -LTCG -DEBUG:FULL") set(_LDFLAGS_DEBUG "-DEBUG:FULL") -set(_LDFLAGS_STATIC "-WX") +set(_LDFLAGS_STATIC "") set(_LDFLAGS_STATIC_RELEASE "-LTCG") set(_LDFLAGS_STATIC_DEBUG "") diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index e325cd6a..3c66cc61 100644 --- a/cmake/opentrack-boilerplate.cmake +++ b/cmake/opentrack-boilerplate.cmake @@ -1,5 +1,9 @@ include_guard(GLOBAL) +if(POLICY CMP0177) + cmake_policy(SET CMP0177 NEW) +endif() + set(opentrack-perms-file WORLD_READ OWNER_WRITE OWNER_READ GROUP_READ) set(opentrack-perms-dir WORLD_READ WORLD_EXECUTE OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE) set(opentrack-perms-exec "${opentrack-perms-dir}") @@ -145,7 +149,7 @@ function(otr_module n_) if(arg_EXECUTABLE) if (APPLE) - set(subsys "MACOSX_BUNDLE") + set(subsys "MACOSX_BUNDLE") elseif(NOT WIN32) set(subsys "") elseif(arg_WIN32-CONSOLE) diff --git a/cmake/opentrack-i18n.cmake b/cmake/opentrack-i18n.cmake index 1f0c67d9..fca83248 100644 --- a/cmake/opentrack-i18n.cmake +++ b/cmake/opentrack-i18n.cmake @@ -1,5 +1,9 @@ include_guard(GLOBAL) +if(POLICY CMP0177) + cmake_policy(SET CMP0177 NEW) +endif() + add_custom_target(i18n-lupdate) add_custom_target(i18n-lrelease DEPENDS i18n-lupdate) add_custom_target(i18n ALL DEPENDS i18n-lrelease) @@ -7,7 +11,7 @@ add_custom_target(i18n ALL DEPENDS i18n-lrelease) function(otr_i18n_for_target_directory n) set(k "opentrack-${n}") - get_property(lupdate-binary TARGET "${Qt5_LUPDATE_EXECUTABLE}" PROPERTY IMPORTED_LOCATION) + get_property(lupdate-binary TARGET Qt6::lupdate PROPERTY IMPORTED_LOCATION) #make_directory("${CMAKE_CURRENT_BINARY_DIR}/lang") @@ -63,7 +67,7 @@ function(otr_merge_translations) foreach(i ${opentrack_all-translations}) get_property(ts-files GLOBAL PROPERTY "opentrack-ts-files-${i}") - get_property(lrelease-binary TARGET "${Qt5_LRELEASE_EXECUTABLE}" PROPERTY IMPORTED_LOCATION) + get_property(lrelease-binary TARGET Qt6::lrelease PROPERTY IMPORTED_LOCATION) set(qm-output "${CMAKE_BINARY_DIR}/${i}.qm") diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake index 5aac983b..8ecb1470 100644 --- a/cmake/opentrack-install.cmake +++ b/cmake/opentrack-install.cmake @@ -1,4 +1,9 @@ include_guard(GLOBAL) + +if(POLICY CMP0177) + cmake_policy(SET CMP0177 NEW) +endif() + macro(otr_install_misc path) install(${ARGN} DESTINATION "${path}" PERMISSIONS ${opentrack-perms-file}) endmacro() diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake index 638260f1..43d9c7a0 100644 --- a/cmake/opentrack-platform.cmake +++ b/cmake/opentrack-platform.cmake @@ -133,7 +133,7 @@ if(MSVC) endif() add_link_options(-DYNAMICBASE -NXCOMPAT) - add_link_options(-WX) + #add_link_options(-WX) add_link_options(-ignore:4020) add_link_options(-ignore:4217) # debug build diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake index 1735e836..8f6dc70e 100644 --- a/cmake/opentrack-qt.cmake +++ b/cmake/opentrack-qt.cmake @@ -1,33 +1,33 @@ include_guard(GLOBAL) -if(WIN32) - find_package(Qt5Gui REQUIRED COMPONENTS QWindowsIntegrationPlugin) -endif() -set(qt-required-components Core Network Widgets LinguistTools Gui) +set(qt-required-components Core Network Widgets LinguistTools Gui Core5Compat) set(qt-optional-components SerialPort) -set(qt-imported-targets Qt5::Core Qt5::Gui Qt5::Network Qt5::Widgets) +set(qt-imported-targets Qt6::Core Qt6::Gui Qt6::Network Qt6::Widgets Qt6::Core5Compat) if(APPLE) list(APPEND qt-required-components "DBus") list(APPEND qt-optional-components "Multimedia") - list(APPEND qt-imported-targets Qt5::DBus Qt5::Multimedia) + list(APPEND qt-imported-targets Qt6::DBus Qt6::Multimedia) endif() -find_package(Qt5 REQUIRED COMPONENTS ${qt-required-components} QUIET) -find_package(Qt5 COMPONENTS ${qt-optional-components} QUIET) +find_package(Qt6 REQUIRED COMPONENTS ${qt-required-components} QUIET) +find_package(Qt6 COMPONENTS ${qt-optional-components} QUIET) +if(WIN32) + find_package(Qt6Gui REQUIRED COMPONENTS QWindowsIntegrationPlugin) +endif() -set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES}) +set(MY_QT_LIBS ${Qt6Core_LIBRARIES} ${Qt6Gui_LIBRARIES} ${Qt6Widgets_LIBRARIES} ${Qt6Network_LIBRARIES} ${Qt6Core5Compat_LIBRARIES}) if(APPLE) - list(APPEND MY_QT_LIBS ${Qt5Multimedia_LIBRARIES} ${Qt5DBus_LIBRARIES}) + list(APPEND MY_QT_LIBS ${Qt6Multimedia_LIBRARIES} ${Qt6DBus_LIBRARIES}) endif() function(otr_install_qt_libs) foreach(i ${qt-imported-targets}) - if(NOT TARGET "${i}") - continue() - endif() + #if(NOT TARGET "${i}") + # continue() + #endif() otr_install_lib(${i} ".") endforeach() if(WIN32) - otr_install_lib(Qt5::QWindowsIntegrationPlugin "./platforms") + otr_install_lib(Qt6::QWindowsIntegrationPlugin "./platforms") endif() endfunction() @@ -39,9 +39,9 @@ function(otr_qt n) if(".${${n}-cc}${${n}-cxx}${${n}-hh}" STREQUAL ".") message(FATAL_ERROR "project ${n} not globbed") endif() - qt5_wrap_cpp(${n}-moc ${${n}-hh} OPTIONS --no-notes -I "${CMAKE_CURRENT_BINARY_DIR}" -I "${CMAKE_SOURCE_DIR}") - qt5_wrap_ui(${n}-uih ${${n}-ui}) - qt5_add_resources(${n}-rcc ${${n}-rc}) + qt6_wrap_cpp(${n}-moc ${${n}-hh} OPTIONS --no-notes -I "${CMAKE_CURRENT_BINARY_DIR}" -I "${CMAKE_SOURCE_DIR}") + qt6_wrap_ui(${n}-uih ${${n}-ui}) + qt6_add_resources(${n}-rcc ${${n}-rc}) foreach(i moc uih rcc) set(${n}-${i} "${${n}-${i}}" PARENT_SCOPE) @@ -52,10 +52,10 @@ endfunction() function(otr_qt2 n) target_include_directories("${n}" SYSTEM PRIVATE - ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} + ${Qt6Core_INCLUDE_DIRS} ${Qt6Gui_INCLUDE_DIRS} ${Qt6Widgets_INCLUDE_DIRS} ${Qt6Network_INCLUDE_DIRS} ) target_compile_definitions("${n}" PRIVATE - ${Qt5Core_DEFINITIONS} ${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS} + ${Qt6Core_DEFINITIONS} ${Qt6Gui_DEFINITIONS} ${Qt6Widgets_DEFINITIONS} ${Qt6Network_DEFINITIONS} -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_MESSAGELOGCONTEXT ) diff --git a/compat/mutex.cpp b/compat/mutex.cpp index 664677ea..71f42329 100644 --- a/compat/mutex.cpp +++ b/compat/mutex.cpp @@ -1,33 +1,31 @@ +#include "export.hpp" #include "mutex.hpp" #include <cstdlib> +#include <QMutex> +#include <QRecursiveMutex> -mutex& mutex::operator=(const mutex& rhs) +template<typename M> +mutex<M>& mutex<M>::operator=(const mutex& rhs) { - if (rhs->isRecursive() != inner.isRecursive()) - std::abort(); - return *this; } -mutex::mutex(const mutex& datum) : mutex{datum.inner.isRecursive() ? Recursive : NonRecursive} -{ -} +template<typename MutexType> MutexType* mutex<MutexType>::operator&() const { return &inner; } -mutex::mutex(RecursionMode m) : inner{m} -{ -} +template<typename M> mutex<M>::mutex(const mutex<M>& datum) {} +template<typename M> mutex<M>::mutex() = default; -QMutex* mutex::operator&() const noexcept +template<typename M> +mutex<M>::operator M*() const noexcept { return &inner; } -mutex::operator QMutex*() const noexcept +template<typename M> +M* mutex<M>::operator->() const noexcept { return &inner; } -QMutex* mutex::operator->() const noexcept -{ - return &inner; -} +template class OTR_COMPAT_EXPORT mutex<QMutex>; +template class OTR_COMPAT_EXPORT mutex<QRecursiveMutex>; diff --git a/compat/mutex.hpp b/compat/mutex.hpp index 54758a08..6ba4fa8c 100644 --- a/compat/mutex.hpp +++ b/compat/mutex.hpp @@ -1,24 +1,18 @@ #pragma once -#include <QMutex> - #include "export.hpp" +template<typename MutexType> class OTR_COMPAT_EXPORT mutex { - mutable QMutex inner; + mutable MutexType inner{}; public: - using RecursionMode = QMutex::RecursionMode; - static constexpr RecursionMode Recursive = RecursionMode::Recursive; - static constexpr RecursionMode NonRecursive = RecursionMode::NonRecursive; - mutex& operator=(const mutex& datum); + MutexType* operator&() const; mutex(const mutex& datum); - explicit mutex(RecursionMode m); - mutex() : mutex{NonRecursive} {} + explicit mutex(); - QMutex* operator&() const noexcept; - explicit operator QMutex*() const noexcept; - QMutex* operator->() const noexcept; + explicit operator MutexType*() const noexcept; + MutexType* operator->() const noexcept; }; diff --git a/compat/process-list.cpp b/compat/process-list.cpp new file mode 100644 index 00000000..690c9e69 --- /dev/null +++ b/compat/process-list.cpp @@ -0,0 +1,188 @@ +#include "process-list.hpp" + +#ifdef _WIN32 + +#include <windows.h> +#include <tlhelp32.h> + +QStringList get_all_executable_names() +{ + QStringList ret; + HANDLE h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (h == INVALID_HANDLE_VALUE) + return ret; + + PROCESSENTRY32 e; + e.dwSize = sizeof(e); + + if (Process32First(h, &e) != TRUE) + { + CloseHandle(h); + return ret; + } + + do { + ret.append(QString{e.szExeFile}); + } while (Process32Next(h, &e) == TRUE); + + CloseHandle(h); + + return ret; +} + +#elif defined __APPLE__ + +QStringList get_all_executable_names() +{ + std::vector<QString> ret; ret.reserve(512); + std::vector<int> vec; vec.reserve(512); + + while (true) + { + int numproc = proc_listpids(PROC_ALL_PIDS, 0, nullptr, 0); + if (numproc == -1) + { + qDebug() << "proc_listpids numproc failed" << errno; + return ret; + } + vec.resize(numproc); + int cnt = proc_listpids(PROC_ALL_PIDS, 0, &vec[0], sizeof(int) * numproc); + + if (cnt <= numproc) + { + std::vector<char> arglist; + int mib[2] { CTL_KERN, KERN_ARGMAX }; + size_t sz = sizeof(int); + int maxarg = 0; + if (sysctl(mib, 2, &maxarg, &sz, NULL, 0) == -1) + { + qDebug() << "sysctl KERN_ARGMAX" << errno; + return ret; + } + arglist.resize(maxarg); + for (int i = 0; i < numproc; i++) + { + size_t maxarg_ = (size_t)maxarg; + int mib[3] { CTL_KERN, KERN_PROCARGS2, vec[i] }; + if (sysctl(mib, 3, &arglist[0], &maxarg_, NULL, 0) == -1) + { + //qDebug() << "sysctl KERN_PROCARGS2" << vec[i] << errno; + continue; + } + QStringList cmdline; + for (unsigned j = sizeof(int) + strlen(&arglist[sizeof(int)]); j < maxarg_; j++) + { + QString arg(&arglist[j]); + if (arg.size() != 0) + { + cmdline << arg; + j += arg.size(); + } + } + if (cmdline.size() > 0) + { + int idx = cmdline[0].lastIndexOf('/'); + if (idx != -1) + { + QString tmp = cmdline[0].mid(idx+1); + if (cmdline.size() > 1 && (tmp == QStringLiteral("wine.bin") || tmp == QStringLiteral("wine"))) + { + idx = cmdline[1].lastIndexOf('/'); + if (idx == -1) + idx = cmdline[1].lastIndexOf('\\'); + if (idx != -1) + { + ret.append(cmdline[1].mid(idx+1)); + } + else + ret.append(cmdline[1]); + } + else + { + ret.append(tmp); + } + } + else + ret.append(cmdline[0]); + } + } + return ret; + } + } +} + +#elif defined __linux__ + +#include <cerrno> + +#ifdef OTR_HAS_LIBPROC2 +#include <libproc2/pids.h> +QStringList get_all_executable_names() +{ + QStringList ret; + enum pids_item items[] = { PIDS_ID_PID, PIDS_CMD, PIDS_CMDLINE_V }; + + enum rel_items { rel_pid, rel_cmd, rel_cmdline }; + struct pids_info *info = NULL; + struct pids_stack *stack; + QString tmp; tmp.reserve(64); + + procps_pids_new(&info, items, 3); + + while ((stack = procps_pids_get(info, PIDS_FETCH_TASKS_ONLY))) + { + char **p_cmdline = PIDS_VAL(rel_cmdline, strv, stack, info); + + // note, wine sets argv[0] so no parsing like in OSX case + if (p_cmdline && p_cmdline[0] && p_cmdline[0][0] && + !(p_cmdline[0][0] == '-' && !p_cmdline[0][1])) + { + tmp = QString{p_cmdline[0]}; + const int idx = std::max(tmp.lastIndexOf('\\'), tmp.lastIndexOf('/')); + if (idx != -1) + tmp = tmp.mid(idx+1); + //qDebug() << "procps" << tmp; + ret.append(tmp); + } + } + //qDebug() << "-- procps end"; + + procps_pids_unref(&info); + + return ret; +} +#else +#include <proc/readproc.h> +#include <cerrno> + +QStringList get_all_executable_names() +{ + QStringList ret; + proc_t** procs = readproctab(PROC_FILLCOM); + if (procs == nullptr) + { + qDebug() << "readproctab" << errno; + return ret; + } + for (int i = 0; procs[i]; i++) + { + // note, wine sets argv[0] so no parsing like in OSX case + auto proc = procs[i]; + if (proc->cmdline && proc->cmdline[0]) + { + QString tmp(proc->cmdline[0]); + const int idx = std::max(tmp.lastIndexOf('\\'), tmp.lastIndexOf('/')); + tmp = tmp.mid(idx == -1 ? 0 : idx+1); + ret.append(tmp); + } + freeproc(procs[i]); + } + free(procs); + return ret; +} +#endif + +#else +QStringList get_all_executable_names() { return {}; } + +#endif diff --git a/compat/process-list.hpp b/compat/process-list.hpp index 39e12603..361efa4f 100644 --- a/compat/process-list.hpp +++ b/compat/process-list.hpp @@ -7,218 +7,9 @@ #pragma once -#include <QDebug> -#include <QStringList> - -#if defined _WIN32 - -#include <windows.h> -#include <tlhelp32.h> - -template<typename = void> -static QStringList get_all_executable_names() -{ - QStringList ret; - HANDLE h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); - if (h == INVALID_HANDLE_VALUE) - return ret; - - PROCESSENTRY32 e; - e.dwSize = sizeof(e); - - if (Process32First(h, &e) != TRUE) - { - CloseHandle(h); - return ret; - } - - do { - ret.append(e.szExeFile); - } while (Process32Next(h, &e) == TRUE); - - CloseHandle(h); - - return ret; -} -#elif defined __APPLE__ -#include <libproc.h> -#include <sys/param.h> -#include <sys/types.h> -#include <sys/sysctl.h> -#include <cerrno> -#include <cstring> +#include "export.hpp" #include <vector> +#include <QString> +#include <QList> -template<typename = void> -static QStringList get_all_executable_names() -{ - QStringList ret; ret.reserve(2048); - std::vector<int> vec; - - while (true) - { - int numproc = proc_listpids(PROC_ALL_PIDS, 0, nullptr, 0); - if (numproc == -1) - { - qDebug() << "proc_listpids numproc failed" << errno; - return ret; - } - vec.resize(numproc); - int cnt = proc_listpids(PROC_ALL_PIDS, 0, &vec[0], sizeof(int) * numproc); - - if (cnt <= numproc) - { - std::vector<char> arglist; - int mib[2] { CTL_KERN, KERN_ARGMAX }; - size_t sz = sizeof(int); - int maxarg = 0; - if (sysctl(mib, 2, &maxarg, &sz, NULL, 0) == -1) - { - qDebug() << "sysctl KERN_ARGMAX" << errno; - return ret; - } - arglist.resize(maxarg); - for (int i = 0; i < numproc; i++) - { - size_t maxarg_ = (size_t)maxarg; - int mib[3] { CTL_KERN, KERN_PROCARGS2, vec[i] }; - if (sysctl(mib, 3, &arglist[0], &maxarg_, NULL, 0) == -1) - { - //qDebug() << "sysctl KERN_PROCARGS2" << vec[i] << errno; - continue; - } - QStringList cmdline; - for (unsigned j = sizeof(int) + strlen(&arglist[sizeof(int)]); j < maxarg_; j++) - { - QString arg(&arglist[j]); - if (arg.size() != 0) - { - cmdline << arg; - j += arg.size(); - } - } - if (cmdline.size() > 0) - { - int idx = cmdline[0].lastIndexOf('/'); - if (idx != -1) - { - QString tmp = cmdline[0].mid(idx+1); - if (cmdline.size() > 1 && (tmp == QStringLiteral("wine.bin") || tmp == QStringLiteral("wine"))) - { - idx = cmdline[1].lastIndexOf('/'); - if (idx == -1) - idx = cmdline[1].lastIndexOf('\\'); - if (idx != -1) - { - ret.append(cmdline[1].mid(idx+1)); - } - else - ret.append(cmdline[1]); - } - else - { - ret.append(tmp); - } - } - else - ret.append(cmdline[0]); - } - } - return ret; - } - } -} - -#elif defined __linux__ - -#include <cerrno> - -#ifdef OTR_HAS_LIBPROC2 -#include <libproc2/pids.h> -template<typename = void> -QStringList get_all_executable_names() -{ - QStringList ret; ret.reserve(2048); - enum pids_item items[] = { PIDS_ID_PID, PIDS_CMD, PIDS_CMDLINE_V }; - - enum rel_items { rel_pid, rel_cmd, rel_cmdline }; - struct pids_info *info = NULL; - struct pids_stack *stack; - QString tmp; tmp.reserve(255); - - procps_pids_new(&info, items, 3); - - // procps-ng version 4.0.5 removed an unused argument in PIDS_VAL() macro. - // cf. https://gitlab.com/procps-ng/procps/-/commit/967fdcfb06e20aad0f3 - - // Although the emitted machine code is identical, backward API - // compatibility was silently broken in the patch with no upgrade path - // (e.g. deprecating PIDS_VAL() while introducing PIDS_VAL2()). - - // Unfortunately, procps-ng doesn't include a #define for identifying its - // version. For these reasons the code below depends on undocumented ABI - // compatibility between procps-ng versions.. -sh 20241226 - -#define OPENTRACK_PIDS_VAL(i, type, stack) stack->head[i].result.type - - while ((stack = procps_pids_get(info, PIDS_FETCH_TASKS_ONLY))) - { - char **p_cmdline = OPENTRACK_PIDS_VAL(rel_cmdline, strv, stack); - - // note, wine sets argv[0] so no parsing like in OSX case - if (p_cmdline && p_cmdline[0] && p_cmdline[0][0] && - !(p_cmdline[0][0] == '-' && !p_cmdline[0][1])) - { - tmp = QString{p_cmdline[0]}; - const int idx = std::max(tmp.lastIndexOf('\\'), tmp.lastIndexOf('/')); - if (idx != -1) - tmp = tmp.mid(idx+1); - //qDebug() << "procps" << tmp; - ret.append(tmp); - } - } - //qDebug() << "-- procps end"; - - procps_pids_unref(&info); - - return ret; -} -#else -#include <proc/readproc.h> -#include <cerrno> - -template<typename = void> -QStringList get_all_executable_names() -{ - QStringList ret; ret.reserve(2048); - proc_t** procs = readproctab(PROC_FILLCOM); - if (procs == nullptr) - { - qDebug() << "readproctab" << errno; - return ret; - } - for (int i = 0; procs[i]; i++) - { - // note, wine sets argv[0] so no parsing like in OSX case - auto proc = procs[i]; - if (proc->cmdline && proc->cmdline[0]) - { - QString tmp(proc->cmdline[0]); - const int idx = std::max(tmp.lastIndexOf('\\'), tmp.lastIndexOf('/')); - tmp = tmp.mid(idx == -1 ? 0 : idx+1); - ret.append(tmp); - } - freeproc(procs[i]); - } - free(procs); - return ret; -} -#endif - -#else -template<typename = void> -static QStringList get_all_executable_names() -{ - return QStringList(); -} -#endif +OTR_COMPAT_EXPORT QStringList get_all_executable_names(); diff --git a/compat/qt-signal.hpp b/compat/qt-signal.hpp index f74de642..92ab7e6f 100644 --- a/compat/qt-signal.hpp +++ b/compat/qt-signal.hpp @@ -3,9 +3,10 @@ // this is to avoid dealing with QMetaObject for the time being -sh 20190203 #include "export.hpp" -namespace options { class slider_value; } #include <QObject> #include <QList> +#include <QPointF> +#include <QVariant> namespace _qt_sig_impl { @@ -52,14 +53,11 @@ template<> struct sig<void> { using t = sig_void; }; template<> struct sig<type> { using t = sig_##type; }; \ template<> struct sig<qlist##type> { using t = qlist##type; } -using slider_value = options::slider_value; - OTR_GENERATE_SIGNAL(int); OTR_GENERATE_SIGNAL(double); OTR_GENERATE_SIGNAL(float); OTR_GENERATE_SIGNAL(bool); OTR_GENERATE_SIGNAL(QString); -OTR_GENERATE_SIGNAL(slider_value); OTR_GENERATE_SIGNAL(QPointF); OTR_GENERATE_SIGNAL(QVariant); @@ -69,4 +67,3 @@ OTR_GENERATE_SIGNAL(QVariant); #undef OTR_GENERATE_SIGNAL template<typename t> using qt_signal = typename _qt_sig_impl::sig<t>::t; - @@ -3,8 +3,8 @@ #include <QObject> #include <QStringList> #include <QIODevice> -#include <QTextCodec> -#include <QRegExp> +#include <QtCore5Compat/QTextCodec> +#include <QtCore5Compat/QRegExp> #include <QtGlobal> class CSV diff --git a/cv/numeric.hpp b/cv/numeric.hpp index 2050e8e4..25ee078b 100644 --- a/cv/numeric.hpp +++ b/cv/numeric.hpp @@ -4,7 +4,7 @@ #include <opencv2/core/matx.hpp> namespace numeric_types { - using f = float; + using f = double; static_assert(std::is_floating_point_v<f>); diff --git a/dinput/win32-joystick.cpp b/dinput/win32-joystick.cpp index cb7a3837..06c1f89f 100644 --- a/dinput/win32-joystick.cpp +++ b/dinput/win32-joystick.cpp @@ -260,7 +260,7 @@ void win32_joy_ctx::enum_state::refresh() const win32_joy_ctx::joys_t& win32_joy_ctx::enum_state::get_joys() const { return joys; } -BOOL CALLBACK win32_joy_ctx::enum_state::EnumJoysticksCallback(const DIDEVICEINSTANCE *pdidInstance, void *pContext) +BOOL CALLBACK win32_joy_ctx::enum_state::EnumJoysticksCallback(const DIDEVICEINSTANCEA *pdidInstance, void *pContext) { enum_state& state = *reinterpret_cast<enum_state*>(pContext); const QString guid = guid_to_string(pdidInstance->guidInstance); @@ -327,7 +327,7 @@ end: return DIENUM_CONTINUE; } -BOOL CALLBACK win32_joy_ctx::enum_state::EnumObjectsCallback(const DIDEVICEOBJECTINSTANCE *pdidoi, void *ctx) +BOOL CALLBACK win32_joy_ctx::enum_state::EnumObjectsCallback(const DIDEVICEOBJECTINSTANCEA* pdidoi, void *ctx) { if (pdidoi->dwType & DIDFT_AXIS) { diff --git a/filter-accela-hamilton/accela_hamilton_dialog.cpp b/filter-accela-hamilton/accela_hamilton_dialog.cpp index 711535f8..bf670d34 100644 --- a/filter-accela-hamilton/accela_hamilton_dialog.cpp +++ b/filter-accela-hamilton/accela_hamilton_dialog.cpp @@ -28,10 +28,10 @@ dialog_accela_hamilton::dialog_accela_hamilton() tie_setting(s.rot_deadzone, ui.rot_dz_slider); tie_setting(s.pos_deadzone, ui.trans_dz_slider); - tie_setting(s.rot_smoothing, ui.rot_gain, [](const slider_value& s) { return tr("%1°").arg(s, 0, 'g', 4); }); - tie_setting(s.pos_smoothing, ui.trans_gain, [](const slider_value& s) { return tr("%1mm").arg(s, 0, 'g', 4); }); - tie_setting(s.rot_deadzone, ui.rot_dz, [](const slider_value& s) { return tr("%1°").arg(s, 0, 'g', 4); }); - tie_setting(s.pos_deadzone, ui.trans_dz, [](const slider_value& s) { return tr("%1mm").arg(s); }); + tie_setting(s.rot_smoothing, ui.rot_gain, [](const slider_value& s) { return tr("%1°").arg(s.cur(), 0, 'g', 4); }); + tie_setting(s.pos_smoothing, ui.trans_gain, [](const slider_value& s) { return tr("%1mm").arg(s.cur(), 0, 'g', 4); }); + tie_setting(s.rot_deadzone, ui.rot_dz, [](const slider_value& s) { return tr("%1°").arg(s.cur(), 0, 'g', 4); }); + tie_setting(s.pos_deadzone, ui.trans_dz, [](const slider_value& s) { return tr("%1mm").arg(s.cur()); }); tie_setting(s.max_zoomed_smoothing, ui.max_zoomed_smoothing); tie_setting(s.max_zoomed_smoothing, ui.lb_max_zoomed_smoothing, [](double x) diff --git a/filter-accela/ftnoir_filter_accela_dialog.cpp b/filter-accela/ftnoir_filter_accela_dialog.cpp index 6a0a35b0..e87fdc03 100644 --- a/filter-accela/ftnoir_filter_accela_dialog.cpp +++ b/filter-accela/ftnoir_filter_accela_dialog.cpp @@ -27,10 +27,10 @@ dialog_accela::dialog_accela() tie_setting(s.rot_deadzone, ui.rot_dz_slider); tie_setting(s.pos_deadzone, ui.trans_dz_slider); - tie_setting(s.rot_smoothing, ui.rot_gain, [](const slider_value& s) { return tr("%1°").arg(s, 0, 'g', 4); }); - tie_setting(s.pos_smoothing, ui.trans_gain, [](const slider_value& s) { return tr("%1mm").arg(s, 0, 'g', 4); }); - tie_setting(s.rot_deadzone, ui.rot_dz, [](const slider_value& s) { return tr("%1°").arg(s, 0, 'g', 4); }); - tie_setting(s.pos_deadzone, ui.trans_dz, [](const slider_value& s) { return tr("%1mm").arg(s); }); + tie_setting(s.rot_smoothing, ui.rot_gain, [](const slider_value& s) { return tr("%1°").arg(s.cur(), 0, 'g', 4); }); + tie_setting(s.pos_smoothing, ui.trans_gain, [](const slider_value& s) { return tr("%1mm").arg(s.cur(), 0, 'g', 4); }); + tie_setting(s.rot_deadzone, ui.rot_dz, [](const slider_value& s) { return tr("%1°").arg(s.cur(), 0, 'g', 4); }); + tie_setting(s.pos_deadzone, ui.trans_dz, [](const slider_value& s) { return tr("%1mm").arg(s.cur()); }); //#define SPLINE_ROT_DEBUG //#define SPLINE_TRANS_DEBUG diff --git a/opentrack/main-window.cpp b/opentrack/main-window.cpp index 20506d81..67ffe1e1 100644 --- a/opentrack/main-window.cpp +++ b/opentrack/main-window.cpp @@ -24,7 +24,6 @@ #include <QMessageBox> #include <QDesktopServices> -#include <QDesktopWidget> #include <QApplication> #include <QFile> diff --git a/options/bundle.hpp b/options/bundle.hpp index 158fcef9..c97eeff2 100644 --- a/options/bundle.hpp +++ b/options/bundle.hpp @@ -21,7 +21,7 @@ #include <QObject> #include <QString> #include <QVariant> -#include <QMutex> +#include <QRecursiveMutex> #include <QDebug> @@ -46,7 +46,7 @@ class OTR_OPTIONS_EXPORT bundle final : public QObject, public connector friend struct bundler; - mutable QMutex mtx { QMutex::Recursive }; + mutable QRecursiveMutex mtx; const QString group_name; group saved; group transient; @@ -62,7 +62,7 @@ public: bundle(const bundle&) = delete; bundle& operator=(const bundle&) = delete; - QMutex* get_mtx() const override { return &mtx; } + QRecursiveMutex* get_mtx() const override { return &mtx; } QString name() const { return group_name; } explicit bundle(const QString& group_name); @@ -93,7 +93,7 @@ struct OTR_OPTIONS_EXPORT bundler final static void reload(); private: - QMutex implsgl_mtx { QMutex::Recursive }; + QRecursiveMutex implsgl_mtx; std::unordered_map<k, weak> implsgl_data {}; void notify_(); @@ -114,4 +114,3 @@ private: void set_value_to_default(value_* val); } // ns options::detail - diff --git a/options/connector.hpp b/options/connector.hpp index 025efda2..bcac5676 100644 --- a/options/connector.hpp +++ b/options/connector.hpp @@ -14,7 +14,7 @@ #include <vector> #include <QString> -#include <QMutex> +#include <QRecursiveMutex> #include "export.hpp" @@ -38,7 +38,7 @@ class OTR_OPTIONS_EXPORT connector protected: void notify_values(const QString& name) const; void notify_all_values() const; - virtual QMutex* get_mtx() const = 0; + virtual QRecursiveMutex* get_mtx() const = 0; void set_all_to_default_(); public: diff --git a/options/globals.hpp b/options/globals.hpp index af242dc9..1a92cc47 100644 --- a/options/globals.hpp +++ b/options/globals.hpp @@ -7,7 +7,7 @@ #include <QString> #include <QSettings> -#include <QMutex> +#include <QRecursiveMutex> namespace options::globals::detail { @@ -17,7 +17,7 @@ struct OTR_OPTIONS_EXPORT ini_ctx { std::optional<QSettings> qsettings { std::in_place }; QString pathname; - QMutex mtx { QMutex::Recursive }; + QRecursiveMutex mtx; unsigned refcount = 0; bool modifiedp = false; diff --git a/options/metatype.cpp b/options/metatype.cpp index 7430c00a..f85429e0 100644 --- a/options/metatype.cpp +++ b/options/metatype.cpp @@ -6,7 +6,6 @@ template<typename t> void declare_metatype_for_type(const char* str) { qRegisterMetaType<t>(str); - qRegisterMetaTypeStreamOperators<t>(); } } // ns options::detail diff --git a/proto-flightgear/ftnoir_protocol_fg.cpp b/proto-flightgear/ftnoir_protocol_fg.cpp index d777d801..32fe3b5b 100644 --- a/proto-flightgear/ftnoir_protocol_fg.cpp +++ b/proto-flightgear/ftnoir_protocol_fg.cpp @@ -26,13 +26,13 @@ void flightgear::pose(const double* headpose, const double*) { } module_status flightgear::initialize() -{ +{ if (outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint)) return status_ok(); else return error(tr("Can't bind to [%1.%2.%3.%4]:%5") - .arg(s.ip1).arg(s.ip2).arg(s.ip3).arg(s.ip4) - .arg(s.port)); + .arg(*s.ip1).arg(*s.ip2).arg(*s.ip3).arg(*s.ip4) + .arg(*s.port)); } OPENTRACK_DECLARE_PROTOCOL(flightgear, FGControls, flightgearDll) diff --git a/qxt-mini/CMakeLists.txt b/qxt-mini/CMakeLists.txt index 1b2496f6..c9b079ad 100644 --- a/qxt-mini/CMakeLists.txt +++ b/qxt-mini/CMakeLists.txt @@ -1,6 +1,6 @@ if(UNIX OR APPLE) set(self opentrack-qxt-mini) - include_directories(SYSTEM ${Qt5Gui_PRIVATE_INCLUDE_DIRS}) + include_directories(SYSTEM ${Qt6Gui_PRIVATE_INCLUDE_DIRS}) otr_module(qxt-mini NO-COMPAT BIN) if(APPLE) find_library(CoreFoundation CoreFoundation) diff --git a/sdk-paths-sthalik@MSVC-windows.cmake b/sdk-paths-sthalik@MSVC-windows.cmake index 187a5da8..40b20d56 100644 --- a/sdk-paths-sthalik@MSVC-windows.cmake +++ b/sdk-paths-sthalik@MSVC-windows.cmake @@ -28,31 +28,31 @@ setq(SDK_VALVE_STEAMVR "steamvr") setq(SDK_FSUIPC "fsuipc") setq(SDK_HYDRA "SixenseSDK") setq(SDK_EYEWARE_BEAM "eyeware-beam-sdk") -setq(SDK_TOBII "nonfree/tobii.streamengine.native.2.2.2.363") +setq(SDK_TOBII "nonfree/tobii-streamengine") if(CMAKE_SIZEOF_VOID_P EQUAL 8) -setq(Qt5_DIR "../qt-5.15-kde-amd64/lib/cmake/Qt5") -setq(OpenCV_DIR "opencv/build-amd64/install") -setq(SDK_ARUCO_LIBPATH "aruco/build-amd64/src/aruco.lib") +setq(Qt6_DIR "../qt6-6.9.0-msvc-amd64/lib/cmake/Qt6") +setq(OpenCV_DIR "opencv/build/amd64/install") +setq(SDK_ARUCO_LIBPATH "aruco/build/amd64/src/aruco.lib") setq(SDK_LIBUSB "libusb-msvc-amd64") setq(ONNXRuntime_DIR "onnxruntime-1.18.0-amd64") -setq(SDK_TRACKHAT_SENSOR "trackhat-c-library-driver/build-amd64/install") -setq(SDK_OSCPACK "oscpack/build-amd64") +#setq(SDK_TRACKHAT_SENSOR "trackhat-c-library-driver/build/amd64/install") +setq(SDK_OSCPACK "oscpack/build/amd64") elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) -setq(Qt5_DIR "../qt/qt-5.15-kde-msvc-32/lib/cmake/Qt5") -setq(OpenCV_DIR "opencv/build/install") -setq(SDK_ARUCO_LIBPATH "aruco/build/src/aruco.lib") +setq(Qt6_DIR "../qt/qt6-6.9.0-msvc-x86/lib/cmake/qt6") +setq(OpenCV_DIR "opencv/build/x86/install") +setq(SDK_ARUCO_LIBPATH "aruco/build/x86/src/aruco.lib") setq(SDK_LIBUSB "libusb-msvc-x86") setq(ONNXRuntime_DIR "onnxruntime-1.18.0-noavx") -setq(SDK_TRACKHAT_SENSOR "trackhat-c-library-driver/build/install") -setq(SDK_OSCPACK "oscpack/build") +#setq(SDK_TRACKHAT_SENSOR "trackhat-c-library-driver/build/install") +setq(SDK_OSCPACK "oscpack/build/x86") else() message(FATAL_ERROR "unknown word size ${CMAKE_SIZEOF_VOID_P}") endif() set(CMAKE_ASM_NASM_COMPILER nasm.exe CACHE FILEPATH "" FORCE) -set(Qt5Core_DIR "${Qt5_DIR}Core" CACHE PATH "" FORCE) -set(Qt5Gui_DIR "${Qt5_DIR}Gui" CACHE PATH "" FORCE) +set(qt6Core_DIR "${qt6_DIR}Core" CACHE PATH "" FORCE) +set(qt6Gui_DIR "${qt6_DIR}Gui" CACHE PATH "" FORCE) if(CMAKE_GENERATOR STREQUAL "NMake Makefiles") set(CMAKE_MAKE_PROGRAM "jom" CACHE STRING "" FORCE) diff --git a/spline/spline.hpp b/spline/spline.hpp index 780442b9..f8748368 100644 --- a/spline/spline.hpp +++ b/spline/spline.hpp @@ -118,7 +118,7 @@ class OTR_SPLINE_EXPORT spline : public base_spline void disconnect_signals(); void invalidate_settings_(); - mutex mtx { mutex::Recursive }; + mutex<QRecursiveMutex> mtx; std::shared_ptr<settings> s; QMetaObject::Connection conn_points, conn_maxx, conn_maxy; diff --git a/tracker-aruco/ftnoir_tracker_aruco.h b/tracker-aruco/ftnoir_tracker_aruco.h index 839be6d5..9229a49c 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.h +++ b/tracker-aruco/ftnoir_tracker_aruco.h @@ -69,7 +69,7 @@ struct settings : opts { class aruco_tracker : protected virtual QThread, public ITracker { - Q_OBJECT + //Q_OBJECT static constexpr float c_search_window = 1.3f; public: aruco_tracker(); diff --git a/tracker-hatire/CMakeLists.txt b/tracker-hatire/CMakeLists.txt index 01dd52b9..e8b34a29 100644 --- a/tracker-hatire/CMakeLists.txt +++ b/tracker-hatire/CMakeLists.txt @@ -1,8 +1,8 @@ -if(Qt5SerialPort_FOUND) +if(Qt6SerialPort_FOUND) otr_module(tracker-hatire) - target_link_libraries(${self} ${Qt5SerialPort_LIBRARIES}) - target_include_directories(${self} SYSTEM PUBLIC ${Qt5SerialPort_INCLUDE_DIRS}) + target_link_libraries(${self} ${Qt6SerialPort_LIBRARIES}) + target_include_directories(${self} SYSTEM PUBLIC ${Qt6SerialPort_INCLUDE_DIRS}) if (WIN32 OR APPLE) - otr_install_lib(Qt5::SerialPort .) + otr_install_lib(Qt6::SerialPort .) endif() endif() diff --git a/tracker-kinect-face/kinect_face_tracker.cpp b/tracker-kinect-face/kinect_face_tracker.cpp index 4bab2eef..1b43681c 100644 --- a/tracker-kinect-face/kinect_face_tracker.cpp +++ b/tracker-kinect-face/kinect_face_tracker.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2019, Stéphane Lenclud <github@lenclud.com> +/* Copyright (c) 2019, Stéphane Lenclud <github@lenclud.com> * Permission to use, copy, modify, and/or distribute this * software for any purpose with or without fee is hereby granted, @@ -187,7 +187,7 @@ void KinectFaceTracker::data(double *data) { //OutputDebugStringA("Skipping frame!\n"); } - + // Feed our framework our last valid position and rotation data[0] = (iLastFacePosition.X - iFacePositionCenter.X) * 100; // Convert to centimer to be in a range that suites OpenTrack. data[1] = (iLastFacePosition.Y - iFacePositionCenter.Y) * 100; @@ -201,7 +201,7 @@ void KinectFaceTracker::data(double *data) /// <summary> -/// Converts rotation quaternion to Euler angles +/// Converts rotation quaternion to Euler angles /// And then maps them to a specified range of values to control the refresh rate /// </summary> /// <param name="pQuaternion">face rotation quaternion</param> @@ -215,7 +215,7 @@ void KinectFaceTracker::ExtractFaceRotationInDegrees(const Vector4* pQuaternion, double z = pQuaternion->z; double w = pQuaternion->w; - // convert face rotation quaternion to Euler angles in degrees + // convert face rotation quaternion to Euler angles in degrees double dPitch, dYaw, dRoll; dPitch = atan2(2 * (y * z + w * x), w * w - x * x - y * y + z * z) / M_PI * 180.0; dYaw = asin(2 * (w * y - x * z)) / M_PI * 180.0; @@ -251,7 +251,7 @@ HRESULT KinectFaceTracker::InitializeDefaultSensor() hr = iKinectSensor->Open(); } - // Create color frame reader + // Create color frame reader if (SUCCEEDED(hr)) { UniqueInterface<IColorFrameSource> colorFrameSource; @@ -263,8 +263,8 @@ HRESULT KinectFaceTracker::InitializeDefaultSensor() hr = colorFrameSource->OpenReader(&iColorFrameReader); } } - - // Create body frame reader + + // Create body frame reader if (SUCCEEDED(hr)) { UniqueInterface<IBodyFrameSource> bodyFrameSource; @@ -339,7 +339,7 @@ void KinectFaceTracker::Update() if (SUCCEEDED(hr)) { hr = pColorFrame->get_RawColorImageFormat(&imageFormat); - } + } if (SUCCEEDED(hr)) { @@ -373,7 +373,7 @@ void KinectFaceTracker::Update() if (SUCCEEDED(hr)) { - // Setup our image + // Setup our image QImage image((const unsigned char*)pBuffer, KColorWidth, KColorHeight, sizeof(RGBQUAD)*KColorWidth, QImage::Format_RGBA8888); if (IsValidRect(iFaceBox)) { @@ -555,7 +555,7 @@ void KinectFaceTracker::ProcessFaces() //IFaceFrameResult* pFaceFrameResult = nullptr; IFaceAlignment* pFaceAlignment = nullptr; CreateFaceAlignment(&pFaceAlignment); // TODO: check return? - //D2D1_POINT_2F faceTextLayout; + //D2D1_POINT_2F faceTextLayout; //hr = pFaceFrame->get_FaceFrameResult(&pFaceFrameResult); @@ -610,5 +610,3 @@ void KinectFaceTracker::ProcessFaces() } } } - - diff --git a/tracker-s2bot/ftnoir_tracker_s2bot.cpp b/tracker-s2bot/ftnoir_tracker_s2bot.cpp index 98a299ca..bf39b367 100644 --- a/tracker-s2bot/ftnoir_tracker_s2bot.cpp +++ b/tracker-s2bot/ftnoir_tracker_s2bot.cpp @@ -7,6 +7,7 @@ #include <cmath> #include <QNetworkRequest> #include <QNetworkReply> +#include <QtCore5Compat/QRegExp> tracker_s2bot::tracker_s2bot() : pose { 0,0,0, 0,0,0 }, m_nam (std::make_unique<QNetworkAccessManager>()) { @@ -51,7 +52,7 @@ void tracker_s2bot::run() { return; } - const QStringList slist = QString::fromLatin1(reply->readAll()).split(QRegExp("[\r\n]+"), QString::SkipEmptyParts); + const QStringList slist = QString::fromLatin1(reply->readAll()).split(QRegularExpression("[\r\n]+"), Qt::SkipEmptyParts); reply->close(); reply->deleteLater(); diff --git a/tracker-steamvr/steamvr.cpp b/tracker-steamvr/steamvr.cpp index 05b5ed35..bd0c9c1e 100644 --- a/tracker-steamvr/steamvr.cpp +++ b/tracker-steamvr/steamvr.cpp @@ -26,7 +26,7 @@ #include <QMessageBox> #include <QDebug> -QMutex device_list::mtx(QMutex::Recursive); +QRecursiveMutex device_list::mtx; template<typename F> auto with_vr_lock(F&& fun) -> decltype(fun(vr_t(), vr_error_t())) diff --git a/tracker-steamvr/steamvr.hpp b/tracker-steamvr/steamvr.hpp index 61da2e05..cc70ffc5 100644 --- a/tracker-steamvr/steamvr.hpp +++ b/tracker-steamvr/steamvr.hpp @@ -8,7 +8,7 @@ #include <climits> #include <QString> -#include <QMutex> +#include <QRecursiveMutex> #include <QList> #include <openvr.h> @@ -57,7 +57,7 @@ struct device_list final private: QList<device_spec> device_specs; - static QMutex mtx; + static QRecursiveMutex mtx; static tt vr_init_(); static void fill_device_specs(QList<device_spec>& list); static tt vr_init(); diff --git a/tracker-wii/wii_module.cpp b/tracker-wii/wii_module.cpp index 0358004f..b384078c 100644 --- a/tracker-wii/wii_module.cpp +++ b/tracker-wii/wii_module.cpp @@ -15,6 +15,8 @@ #include "pt-api.hpp" +#include "compat/linkage-macros.hpp" + #include <memory> static const QString module_name = "tracker-wii-pt"; @@ -62,8 +64,10 @@ struct wii_dialog_pt : TrackerDialog_PT wii_dialog_pt(); }; -struct wii_metadata_pt : Metadata +struct OTR_GENERIC_EXPORT wii_metadata_pt : Metadata { + Q_OBJECT + QString name() { return tr("WiiPointTracker 1.1"); } QIcon icon() { return QIcon(":/Resources/wii.png"); } }; diff --git a/video/video-widget.hpp b/video/video-widget.hpp index 4f54b2b9..d70ee443 100644 --- a/video/video-widget.hpp +++ b/video/video-widget.hpp @@ -18,7 +18,7 @@ #include <QImage> #include <QTimer> -#include <QMutex> +#include <QRecursiveMutex> struct OTR_VIDEO_EXPORT video_widget : QWidget { @@ -32,7 +32,7 @@ struct OTR_VIDEO_EXPORT video_widget : QWidget bool fresh() const; protected: - mutable QMutex mtx { QMutex::NonRecursive }; + mutable QRecursiveMutex mtx; QImage texture; std::vector<unsigned char> vec; void set_fresh(bool x); |