diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-01-06 20:07:13 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-01-06 20:16:18 +0100 |
commit | 82f3d7373234cc0db79a22d476cb54b5eda7a0ea (patch) | |
tree | 65ee0194ad064cc470f95f7ca8efd533b089ca96 /gui | |
parent | 7e3807d048c5e0a8e0aa64fb49807bf5dfd11fc1 (diff) | |
parent | f02baa0868f219076a641634625f7c032d3a9eef (diff) |
Merge branch 'unstable' into trackhat
* unstable: (140 commits)
tracker/pt: increase auto threshold bucket size again
tracker/pt: limit max amount of extracted blobs
gui: don't update main window if we're minimized
tracker/pt: only show widget if the frame is visible
tracker/pt: don't resize twice in widget
freetrack/games: regen
contrib/make-csv: perl sort isn't stable, don't ignore case
tracker/pt: avoid widget temp QImage allocation
spline-widget: oops, pass by reference
tracker/pt: don't allocate temporary dynamic size arrays
tracker/pt: don't copy points array needlessly
tracker/pt: don't allocate temporary frame
tracker/pt: cv::Mat::at<T> is slow, use cv::Mat::ptr
tracker/pt: avoid widget malloc when able
tracker/pt: optimize widget
tracker/pt: update video widget at 40 -> 50 ms
cmake/mingw-w64: update
tracker/pt: reduce mutex contention
gui: fix left margin
tracker/pt: remove krap
tracker/pt: move ctor out of the loop
tracker/pt: nix unused
tracker/pt: don't fill mask on frame
pose-widget: also bilinear interpolation of alpha value
ui: adjust margin
ui: make more compact
glwidget: use transparent octopus background
api/mat: fix typos/breakage
api/joy: refresh only manually on certain events
pt: histogram more granular 6 -> 8
cmake/api: link with strmiids.lib on win32
tracker/pt: reduce auto thresholding histogram bucket size
api/keys: prevent idempotent keys
api/joy: move from header
api/joy: prevent idempotent keypressed passed to receiver
compat/options: get rid of std::string usage
compat/options: move from header
gui/settings: set parent, otherwise not modal
gui/settings: don't forget to show a modal dialog before executing
gui/main: don't raise a new window, it's enough to set visible
api/joy: speed up poll_axis path
api/joy: nix static, now that we're not a singleton
tracker/joy: adapt to non-singleton joy worker
joystick: no longer singleton, use fake window handle
api/keys: use a fake window for DirectInput handle
gui/keys: allow for pausing global keystrokes for options dialog
api/keys: nix tautological #ifdef
contrib/aruco: oops, right extension
contrib/aruco: use @frost555's marker image
api/camera-names: move to compat/
...
Diffstat (limited to 'gui')
-rw-r--r-- | gui/CMakeLists.txt | 14 | ||||
-rw-r--r-- | gui/curve-config.cpp | 6 | ||||
-rw-r--r-- | gui/keyboard.h | 32 | ||||
-rw-r--r-- | gui/main.cpp | 2 | ||||
-rw-r--r-- | gui/main.ui | 1526 | ||||
-rw-r--r-- | gui/new_file_dialog.h | 2 | ||||
-rw-r--r-- | gui/options-dialog.cpp | 138 | ||||
-rw-r--r-- | gui/options-dialog.hpp | 13 | ||||
-rw-r--r-- | gui/process_detector.h | 2 | ||||
-rw-r--r-- | gui/settings.ui | 192 | ||||
-rw-r--r-- | gui/software-update-dialog.hpp | 2 | ||||
-rw-r--r-- | gui/ui.cpp | 108 | ||||
-rw-r--r-- | gui/ui.h | 23 | ||||
-rw-r--r-- | gui/wizard.h | 2 |
14 files changed, 1178 insertions, 884 deletions
diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index f56641fb..778cbf08 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -41,4 +41,18 @@ if(LINUX) target_link_libraries(opentrack procps) endif() +set(c-props) +set(l-props) +if(CMAKE_COMPILER_IS_GNUCXX) + set(c-props "-fvisibility=hidden -fvisibility-inlines-hidden") + if(NOT APPLE) + set(l-props "-Wl,--as-needed") + endif() +endif() + +set_target_properties(opentrack PROPERTIES + LINK_FLAGS "${l-props}" + COMPILE_FLAGS "${c-props}" +) + install(TARGETS opentrack DESTINATION .) diff --git a/gui/curve-config.cpp b/gui/curve-config.cpp index 2e9065b4..7cd78580 100644 --- a/gui/curve-config.cpp +++ b/gui/curve-config.cpp @@ -54,6 +54,12 @@ MapWidget::MapWidget(Mappings& m, main_settings& s) : qfc.setEnabled(qfcs[i].checkbox->isChecked()); qfc.force_redraw(); } + + if (qfcs[i].axis >= 3) + qfcs[i].qfc->set_snap(2, 5); + else + qfcs[i].qfc->set_snap(1, 5); + qfcs[i].qfc->setConfig(conf, name); } } diff --git a/gui/keyboard.h b/gui/keyboard.h index 62a9ce20..696df605 100644 --- a/gui/keyboard.h +++ b/gui/keyboard.h @@ -2,7 +2,7 @@ #include "ui_keyboard_listener.h" #ifdef _WIN32 #include "opentrack/win32-shortcuts.h" -#include "opentrack/shortcuts.h" +#include "opentrack/keybinding-worker.hpp" #endif #include <QLabel> #include <QKeyEvent> @@ -13,25 +13,32 @@ class KeyboardListener : public QLabel Q_OBJECT Ui_keyboard_listener ui; #ifdef _WIN32 - KeybindingWorker w; + KeybindingWorker::Token token; #endif public: KeyboardListener(QWidget* parent = nullptr) : QLabel(parent) #ifdef _WIN32 - , w([&](Key& k) - { - Qt::KeyboardModifiers m; - QKeySequence k_; - if (win_key::to_qt(k, k_, m)) - key_pressed(static_cast<QVariant>(k_).toInt() | m); - }, this->winId()) + , token([&](const Key& k) { + if(k.guid != "") + { + int mods = 0; + if (k.alt) mods |= Qt::AltModifier; + if (k.shift) mods |= Qt::ShiftModifier; + if (k.ctrl) mods |= Qt::ControlModifier; + joystick_button_pressed(k.guid, k.keycode | mods, k.held); + } + else + { + Qt::KeyboardModifiers m; + QKeySequence k_; + if (win_key::to_qt(k, k_, m)) + key_pressed(static_cast<QVariant>(k_).toInt() | m); + } + }) #endif { ui.setupUi(this); setFocusPolicy(Qt::StrongFocus); -#ifdef _WIN32 - w.start(); -#endif } #ifndef _WIN32 void keyPressEvent(QKeyEvent* event) override @@ -47,4 +54,5 @@ public: #endif signals: void key_pressed(QKeySequence k); + void joystick_button_pressed(QString guid, int idx, bool held); }; diff --git a/gui/main.cpp b/gui/main.cpp index 4e56b3df..43a8b0c6 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -5,8 +5,8 @@ #include "opentrack/opencv-camera-dialog.hpp" #include "wizard.h" #include "ui.h" -#include "opentrack/options.hpp" #include "ui_install-driver-dialog.h" +#include "opentrack-compat/options.hpp" using namespace options; #include <QApplication> #include <QCommandLineParser> diff --git a/gui/main.ui b/gui/main.ui index 532d3124..43f725af 100644 --- a/gui/main.ui +++ b/gui/main.ui @@ -7,8 +7,8 @@ <rect> <x>0</x> <y>0</y> - <width>693</width> - <height>575</height> + <width>646</width> + <height>435</height> </rect> </property> <property name="windowIcon"> @@ -37,10 +37,10 @@ <number>0</number> </property> <property name="rightMargin"> - <number>0</number> + <number>6</number> </property> <property name="bottomMargin"> - <number>0</number> + <number>6</number> </property> <item> <widget class="QFrame" name="frame"> @@ -53,7 +53,10 @@ <property name="lineWidth"> <number>0</number> </property> - <layout class="QGridLayout" name="gridLayout_5"> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <property name="spacing"> + <number>0</number> + </property> <property name="leftMargin"> <number>0</number> </property> @@ -66,11 +69,14 @@ <property name="bottomMargin"> <number>0</number> </property> - <property name="spacing"> - <number>0</number> - </property> - <item row="0" column="0"> + <item> <widget class="QFrame" name="top"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> @@ -88,26 +94,20 @@ <number>0</number> </property> <property name="bottomMargin"> - <number>0</number> + <number>4</number> </property> <item> <widget class="QFrame" name="video_feed"> <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>480</width> - <height>360</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>480</width> - <height>360</height> + <width>320</width> + <height>240</height> </size> </property> <widget class="QFrame" name="video_frame"> @@ -115,12 +115,12 @@ <rect> <x>0</x> <y>0</y> - <width>480</width> - <height>360</height> + <width>320</width> + <height>240</height> </rect> </property> <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -130,8 +130,8 @@ <rect> <x>0</x> <y>0</y> - <width>480</width> - <height>360</height> + <width>320</width> + <height>240</height> </rect> </property> <property name="sizePolicy"> @@ -142,83 +142,761 @@ </property> <property name="minimumSize"> <size> - <width>480</width> - <height>360</height> + <width>320</width> + <height>240</height> </size> </property> <property name="maximumSize"> <size> - <width>480</width> - <height>360</height> + <width>320</width> + <height>240</height> </size> </property> <property name="text"> <string/> </property> + <property name="pixmap"> + <pixmap resource="ui-res.qrc">:/images/no-feed.png</pixmap> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> </widget> </widget> </widget> </item> <item> - <widget class="QFrame" name="top_display"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> + <widget class="GLWidget" name="pose_display" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="lineWidth"> - <number>0</number> + <property name="minimumSize"> + <size> + <width>320</width> + <height>240</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QFrame" name="top_display"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="lineWidth"> + <number>0</number> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <property name="spacing"> + <number>6</number> + </property> + <property name="leftMargin"> + <number>5</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <item> + <widget class="QGroupBox" name="box_raw_headpose"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string notr="true">Raw tracker data</string> </property> - <layout class="QVBoxLayout"> + <layout class="QGridLayout" name="gridLayout_12"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> <property name="spacing"> - <number>12</number> + <number>0</number> </property> + <item row="0" column="3"> + <widget class="QLCDNumber" name="raw_yaw"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Outline</enum> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="lblZ_4"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>TZ</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="lblRotY_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>pitch</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QLCDNumber" name="raw_pitch"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Outline</enum> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="lblY_4"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>TY</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="lblX_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>TX</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLCDNumber" name="raw_x"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Outline</enum> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="lblRotZ_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>roll</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="lblRotX_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>yaw</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLCDNumber" name="raw_y"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Outline</enum> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QLCDNumber" name="raw_roll"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Outline</enum> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLCDNumber" name="raw_z"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Outline</enum> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="box_mapped_headpose"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string notr="true">Game data</string> + </property> + <layout class="QGridLayout" name="gridLayout_14"> <property name="leftMargin"> - <number>6</number> + <number>0</number> </property> <property name="topMargin"> - <number>12</number> + <number>0</number> </property> <property name="rightMargin"> - <number>8</number> + <number>0</number> </property> <property name="bottomMargin"> - <number>4</number> + <number>0</number> </property> - <item> - <widget class="GLWidget" name="pose_display" native="true"> + <property name="spacing"> + <number>0</number> + </property> + <item row="1" column="3"> + <widget class="QLCDNumber" name="pose_pitch"> + <property name="enabled"> + <bool>true</bool> + </property> <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="maximumSize"> - <size> - <width>110</width> - <height>120</height> - </size> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> </property> </widget> </item> - <item> - <widget class="QGroupBox" name="box_raw_headpose"> + <item row="0" column="3"> + <widget class="QLCDNumber" name="pose_yaw"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLCDNumber" name="pose_z"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="lblx"> <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum"> + <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>TX</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="lblY_2"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>TY</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLCDNumber" name="pose_x"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="lblRotY_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>pitch</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="lblRotZ_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>roll</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="lblRotX_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>yaw</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="lblZ_2"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>TZ</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLCDNumber" name="pose_y"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QLCDNumber" name="pose_roll"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QFrame" name="bottom_controls"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <item row="0" column="0"> + <widget class="QFrame" name="frame_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>4</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>2</number> + </property> + <property name="leftMargin"> + <number>3</number> + </property> + <property name="topMargin"> + <number>2</number> + </property> + <property name="rightMargin"> + <number>3</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <item> + <widget class="QGroupBox" name="groupGameProtocol"> <property name="title"> - <string notr="true">Raw tracker data</string> + <string>Protocol</string> </property> - <layout class="QGridLayout" name="gridLayout_12"> + <layout class="QGridLayout" name="gridLayout_4"> <property name="leftMargin"> - <number>0</number> + <number>4</number> </property> <property name="topMargin"> <number>0</number> </property> <property name="rightMargin"> - <number>0</number> + <number>4</number> </property> <property name="bottomMargin"> <number>0</number> @@ -227,322 +905,47 @@ <number>3</number> </property> <property name="verticalSpacing"> - <number>2</number> + <number>0</number> </property> - <item row="0" column="1"> - <widget class="QLCDNumber" name="raw_x"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="lineWidth"> - <number>1</number> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Outline</enum> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="lblRotX_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>yaw</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="lblRotZ_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>roll</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="lblZ_4"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>TZ</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="lblRotY_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>pitch</string> - </property> - </widget> + <item row="1" column="0"> + <widget class="QComboBox" name="iconcomboProtocol"/> </item> <item row="1" column="1"> - <widget class="QLCDNumber" name="raw_y"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="lineWidth"> - <number>1</number> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Outline</enum> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLCDNumber" name="raw_yaw"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="lineWidth"> - <number>1</number> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Outline</enum> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QLCDNumber" name="raw_roll"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="lineWidth"> - <number>1</number> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Outline</enum> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLCDNumber" name="raw_z"> + <widget class="QToolButton" name="btnShowServerControls"> <property name="enabled"> <bool>true</bool> </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="lineWidth"> - <number>1</number> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Outline</enum> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="lblX_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> <property name="text"> - <string>TX</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QLCDNumber" name="raw_pitch"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="lineWidth"> - <number>1</number> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Outline</enum> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="lblY_4"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <string>...</string> </property> - <property name="autoFillBackground"> + <property name="flat" stdset="0"> <bool>false</bool> </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>TY</string> - </property> </widget> </item> </layout> </widget> </item> <item> - <widget class="QGroupBox" name="box_mapped_headpose"> + <widget class="QGroupBox" name="groupStartStop"> <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum"> - <horstretch>0</horstretch> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>3</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="title"> - <string notr="true">Game data</string> + <string notr="true">Controls</string> </property> - <layout class="QGridLayout" name="gridLayout_14"> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <property name="spacing"> + <number>8</number> + </property> <property name="leftMargin"> <number>0</number> </property> <property name="topMargin"> - <number>0</number> + <number>4</number> </property> <property name="rightMargin"> <number>0</number> @@ -550,267 +953,32 @@ <property name="bottomMargin"> <number>0</number> </property> - <property name="horizontalSpacing"> - <number>3</number> - </property> - <property name="verticalSpacing"> - <number>2</number> - </property> - <item row="1" column="0"> - <widget class="QLabel" name="lblY_2"> - <property name="enabled"> - <bool>true</bool> - </property> + <item> + <widget class="QToolButton" name="btnStartTracker"> <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> <property name="text"> - <string>TY</string> + <string>Start</string> </property> </widget> </item> - <item row="2" column="0"> - <widget class="QLabel" name="lblZ_2"> + <item> + <widget class="QToolButton" name="btnStopTracker"> <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="autoFillBackground"> <bool>false</bool> </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>TZ</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="lblRotZ_2"> <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> <property name="text"> - <string>roll</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLCDNumber" name="pose_x"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="lblRotX_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>yaw</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="lblRotY_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>pitch</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="lblx"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>TX</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QLCDNumber" name="pose_pitch"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLCDNumber" name="pose_y"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QLCDNumber" name="pose_roll"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLCDNumber" name="pose_z"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLCDNumber" name="pose_yaw"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> + <string>Stop</string> </property> </widget> </item> @@ -820,141 +988,89 @@ </layout> </widget> </item> - </layout> - </widget> - </item> - <item row="1" column="0"> - <widget class="QFrame" name="bottom_controls"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <property name="leftMargin"> - <number>4</number> - </property> - <property name="topMargin"> - <number>8</number> - </property> - <property name="rightMargin"> - <number>10</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <property name="horizontalSpacing"> - <number>4</number> - </property> - <property name="verticalSpacing"> - <number>0</number> - </property> - <item row="1" column="1"> - <widget class="QGroupBox" name="groupWindows"> + <item row="0" column="1"> + <widget class="QFrame" name="groupWindows"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>4</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="title"> - <string>Settings</string> - </property> - <property name="flat"> - <bool>true</bool> + <property name="lineWidth"> + <number>0</number> </property> <layout class="QVBoxLayout" name="verticalLayout_3"> <property name="spacing"> <number>3</number> </property> <property name="leftMargin"> - <number>4</number> + <number>0</number> </property> <property name="topMargin"> - <number>2</number> + <number>0</number> </property> <property name="rightMargin"> <number>0</number> </property> <property name="bottomMargin"> - <number>6</number> + <number>0</number> </property> <item> - <widget class="QGroupBox" name="groupGameProtocol"> - <property name="title"> - <string>Protocol</string> + <widget class="QFrame" name="groupProfile"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <layout class="QGridLayout" name="gridLayout_4"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>0</number> + </property> <property name="leftMargin"> - <number>4</number> + <number>0</number> </property> <property name="topMargin"> <number>0</number> </property> <property name="rightMargin"> - <number>4</number> - </property> - <property name="bottomMargin"> <number>0</number> </property> - <property name="horizontalSpacing"> - <number>3</number> - </property> - <property name="verticalSpacing"> + <property name="bottomMargin"> <number>0</number> </property> - <item row="0" column="0"> - <widget class="QComboBox" name="iconcomboProtocol"/> - </item> - <item row="0" column="1"> - <widget class="QToolButton" name="btnShowServerControls"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="text"> - <string>...</string> - </property> - <property name="flat" stdset="0"> - <bool>false</bool> - </property> - </widget> - </item> </layout> </widget> </item> <item> - <widget class="QFrame" name="groupProfile"> + <widget class="QFrame" name="frame_3"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> + <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> <horstretch>0</horstretch> - <verstretch>2</verstretch> + <verstretch>0</verstretch> </sizepolicy> </property> - <layout class="QHBoxLayout" name="horizontalLayout"> + <layout class="QHBoxLayout" name="horizontalLayout_5"> <property name="spacing"> <number>0</number> </property> <property name="leftMargin"> <number>0</number> </property> + <property name="topMargin"> + <number>0</number> + </property> <property name="rightMargin"> - <number>2</number> + <number>0</number> </property> <property name="bottomMargin"> - <number>2</number> + <number>0</number> </property> <item> <widget class="QToolButton" name="profile_button"> <property name="enabled"> <bool>true</bool> </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="text"> <string>Profile</string> </property> @@ -975,7 +1091,7 @@ <item> <widget class="QComboBox" name="iconcomboProfile"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -991,9 +1107,9 @@ <item> <widget class="QPushButton" name="btnEditCurves"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <horstretch>0</horstretch> - <verstretch>3</verstretch> + <verstretch>0</verstretch> </sizepolicy> </property> <property name="text"> @@ -1014,9 +1130,9 @@ <item> <widget class="QPushButton" name="btnShortcuts"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <horstretch>0</horstretch> - <verstretch>3</verstretch> + <verstretch>0</verstretch> </sizepolicy> </property> <property name="text"> @@ -1037,68 +1153,6 @@ </layout> </widget> </item> - <item row="1" column="0"> - <widget class="QGroupBox" name="groupStartStop"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>3</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string notr="true">Controls</string> - </property> - <property name="flat"> - <bool>true</bool> - </property> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <property name="spacing"> - <number>8</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>8</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>9</number> - </property> - <item> - <widget class="QToolButton" name="btnStartTracker"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Start</string> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="btnStopTracker"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Stop</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> </layout> </widget> </item> @@ -1116,12 +1170,12 @@ </customwidget> </customwidgets> <tabstops> - <tabstop>btnStartTracker</tabstop> <tabstop>btnStopTracker</tabstop> <tabstop>iconcomboProtocol</tabstop> <tabstop>btnShowServerControls</tabstop> - <tabstop>btnEditCurves</tabstop> <tabstop>btnShortcuts</tabstop> + <tabstop>profile_button</tabstop> + <tabstop>iconcomboProfile</tabstop> </tabstops> <resources> <include location="ui-res.qrc"/> diff --git a/gui/new_file_dialog.h b/gui/new_file_dialog.h index 3a35cf71..5fdabb3a 100644 --- a/gui/new_file_dialog.h +++ b/gui/new_file_dialog.h @@ -1,7 +1,7 @@ #pragma once #include "ui_new_config.h" -#include "opentrack/options.hpp" +#include "opentrack-compat/options.hpp" #include <QFile> #include <QRegExp> #include <QString> diff --git a/gui/options-dialog.cpp b/gui/options-dialog.cpp index 06346b25..1e734135 100644 --- a/gui/options-dialog.cpp +++ b/gui/options-dialog.cpp @@ -11,38 +11,42 @@ #include "keyboard.h" #include <QPushButton> #include <QLayout> +#include <QDialog> -OptionsDialog::OptionsDialog(State& state) : state(state), trans_calib_running(false) +static QString kopts_to_string(const key_opts& kopts) { - ui.setupUi( this ); + if (static_cast<QString>(kopts.guid) != "") + { + const int btn = kopts.button & ~Qt::KeyboardModifierMask; + const int mods = kopts.button & Qt::KeyboardModifierMask; + QString mm; + if (mods & Qt::ControlModifier) mm += "Control+"; + if (mods & Qt::AltModifier) mm += "Alt+"; + if (mods & Qt::ShiftModifier) mm += "Shift+"; + return mm + "Joy button " + QString::number(btn); + } + if (static_cast<QString>(kopts.keycode) == "") + return "None"; + return kopts.keycode; +} + +OptionsDialog::OptionsDialog(main_settings& main, + State& state, + std::function<void()> register_global_keys, + std::function<void(bool)> pause_keybindings) : + main(main), + state(state), + register_global_keys(register_global_keys), + pause_keybindings(pause_keybindings) +{ + ui.setupUi(this); connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - tie_setting(s.s_main.tray_enabled, ui.trayp); - - tie_setting(s.s_main.center_at_startup, ui.center_at_startup); + tie_setting(main.tray_enabled, ui.trayp); - tie_setting(s.s_main.tcomp_p, ui.tcomp_enable); - tie_setting(s.s_main.tcomp_tz, ui.tcomp_rz); - - tie_setting(s.s_main.a_yaw.invert, ui.invert_yaw); - tie_setting(s.s_main.a_pitch.invert, ui.invert_pitch); - tie_setting(s.s_main.a_roll.invert, ui.invert_roll); - tie_setting(s.s_main.a_x.invert, ui.invert_x); - tie_setting(s.s_main.a_y.invert, ui.invert_y); - tie_setting(s.s_main.a_z.invert, ui.invert_z); - - tie_setting(s.s_main.a_yaw.src, ui.src_yaw); - tie_setting(s.s_main.a_pitch.src, ui.src_pitch); - tie_setting(s.s_main.a_roll.src, ui.src_roll); - tie_setting(s.s_main.a_x.src, ui.src_x); - tie_setting(s.s_main.a_y.src, ui.src_y); - tie_setting(s.s_main.a_z.src, ui.src_z); - - tie_setting(s.s_main.camera_yaw, ui.camera_yaw); - tie_setting(s.s_main.camera_pitch, ui.camera_pitch); - tie_setting(s.s_main.camera_roll, ui.camera_roll); + tie_setting(main.center_at_startup, ui.center_at_startup); tie_setting(pt.camera_mode, ui.camera_mode); @@ -86,48 +90,96 @@ OptionsDialog::OptionsDialog(State& state) : state(state), trans_calib_running(f timer.start(100); - connect(ui.bind_center, &QPushButton::pressed, [&]() -> void { bind_key(s.center.keycode, ui.center_text); }); - connect(ui.bind_zero, &QPushButton::pressed, [&]() -> void { bind_key(s.zero.keycode, ui.zero_text); }); - connect(ui.bind_toggle, &QPushButton::pressed, [&]() -> void { bind_key(s.toggle.keycode, ui.toggle_text); }); + tie_setting(main.tcomp_p, ui.tcomp_enable); + tie_setting(main.tcomp_tz, ui.tcomp_rz); + + tie_setting(main.a_yaw.invert, ui.invert_yaw); + tie_setting(main.a_pitch.invert, ui.invert_pitch); + tie_setting(main.a_roll.invert, ui.invert_roll); + tie_setting(main.a_x.invert, ui.invert_x); + tie_setting(main.a_y.invert, ui.invert_y); + tie_setting(main.a_z.invert, ui.invert_z); - ui.center_text->setText(s.center.keycode == "" ? "None" : static_cast<QString>(s.center.keycode)); - ui.toggle_text->setText(s.toggle.keycode == "" ? "None" : static_cast<QString>(s.toggle.keycode)); - ui.zero_text->setText(s.zero.keycode == "" ? "None" : static_cast<QString>(s.zero.keycode)); + tie_setting(main.a_yaw.src, ui.src_yaw); + tie_setting(main.a_pitch.src, ui.src_pitch); + tie_setting(main.a_roll.src, ui.src_roll); + tie_setting(main.a_x.src, ui.src_x); + tie_setting(main.a_y.src, ui.src_y); + tie_setting(main.a_z.src, ui.src_z); + + tie_setting(main.camera_yaw, ui.camera_yaw); + tie_setting(main.camera_pitch, ui.camera_pitch); + tie_setting(main.camera_roll, ui.camera_roll); + + tie_setting(main.center_method, ui.center_method); + + connect(ui.bind_center, &QPushButton::pressed, [&]() -> void { bind_key(main.key_center, ui.center_text); }); + connect(ui.bind_zero, &QPushButton::pressed, [&]() -> void { bind_key(main.key_zero, ui.zero_text); }); + connect(ui.bind_toggle, &QPushButton::pressed, [&]() -> void { bind_key(main.key_toggle, ui.toggle_text); }); + connect(ui.bind_start, &QPushButton::pressed, [&]() -> void { bind_key(main.key_start_tracking, ui.start_tracking_text); }); + connect(ui.bind_stop, &QPushButton::pressed, [&]() -> void { bind_key(main.key_stop_tracking, ui.stop_tracking_text); }); + connect(ui.bind_toggle_tracking, &QPushButton::pressed, [&]() -> void { bind_key(main.key_toggle_tracking, ui.toggle_tracking_text); }); + + ui.center_text->setText(kopts_to_string(main.key_center)); + ui.toggle_text->setText(kopts_to_string(main.key_toggle)); + ui.zero_text->setText(kopts_to_string(main.key_zero)); + + ui.start_tracking_text->setText(kopts_to_string(main.key_start_tracking)); + ui.stop_tracking_text->setText(kopts_to_string(main.key_stop_tracking)); + ui.toggle_tracking_text->setText(kopts_to_string(main.key_toggle_tracking)); } -void OptionsDialog::bind_key(value<QString>& ret, QLabel* label) +void OptionsDialog::bind_key(key_opts& kopts, QLabel* label) { - ret = ""; - QDialog d; + kopts.button = -1; + kopts.guid = ""; + kopts.keycode = ""; + QDialog d(this); auto l = new QHBoxLayout; l->setMargin(0); - auto k = new KeyboardListener; - l->addWidget(k); + KeyboardListener k; + l->addWidget(&k); d.setLayout(l); d.setFixedSize(QSize(500, 300)); d.setWindowFlags(Qt::Dialog); - connect(k, &KeyboardListener::key_pressed, [&] (QKeySequence s) -> void { ret = s.toString(QKeySequence::PortableText); d.close(); }); + d.setWindowModality(Qt::ApplicationModal); + connect(&k, &KeyboardListener::key_pressed, [&] (QKeySequence s) -> void { + kopts.keycode = s.toString(QKeySequence::PortableText); + kopts.guid = ""; + kopts.button = -1; + d.close(); + }); + connect(&k, &KeyboardListener::joystick_button_pressed, [&](QString guid, int idx, bool held) -> void { + if (!held) + { + kopts.guid = guid; + kopts.keycode = ""; + kopts.button = idx; + d.close(); + } + }); + pause_keybindings(true); + d.show(); d.exec(); - label->setText(ret == "" ? "None" : static_cast<QString>(ret)); - delete k; + pause_keybindings(false); + register_global_keys(); + label->setText(kopts_to_string(kopts)); delete l; } void OptionsDialog::doOK() { - s.b->save(); pt.b->save(); - s.s_main.b->save(); acc.b->save(); + main.b->save(); ui.game_detector->save(); this->close(); emit reload(); } void OptionsDialog::doCancel() { - s.b->reload(); pt.b->reload(); - s.s_main.b->reload(); acc.b->reload(); + main.b->reload(); ui.game_detector->revert(); close(); } diff --git a/gui/options-dialog.hpp b/gui/options-dialog.hpp index 8fc16611..f333c690 100644 --- a/gui/options-dialog.hpp +++ b/gui/options-dialog.hpp @@ -10,6 +10,9 @@ #include "trans_calib.h" #include "tracker-pt/ftnoir_tracker_pt.h" #include "filter-accela/ftnoir_filter_accela.h" +#include <QObject> +#include <QWidget> +#include <functional> class OptionsDialog: public QWidget { @@ -17,14 +20,16 @@ class OptionsDialog: public QWidget signals: void reload(); public: - OptionsDialog(State &state); + OptionsDialog(main_settings& main, State& state, std::function<void()> register_global_keys, std::function<void(bool)> pause_keybindings); private: + main_settings& main; + State& state; + std::function<void()> register_global_keys; + std::function<void(bool)> pause_keybindings; Ui::UI_Settings ui; - Shortcuts::settings s; settings_pt pt; settings_accela acc; QTimer timer; - State& state; TranslationCalibrator trans_calib; bool trans_calib_running; @@ -42,5 +47,5 @@ private slots: void startstop_trans_calib(bool start); void poll_tracker_info(); void trans_calib_step(); - void bind_key(value<QString>& ret, QLabel* label); + void bind_key(key_opts &kopts, QLabel* label); }; diff --git a/gui/process_detector.h b/gui/process_detector.h index f6497c90..e395e1a2 100644 --- a/gui/process_detector.h +++ b/gui/process_detector.h @@ -13,7 +13,7 @@ #include <QTableWidget> #include <QResizeEvent> -#include "opentrack/options.hpp" +#include "opentrack-compat/options.hpp" using namespace options; class FancyTable : public QTableWidget diff --git a/gui/settings.ui b/gui/settings.ui index 5bf819fd..cb292a35 100644 --- a/gui/settings.ui +++ b/gui/settings.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>428</width> - <height>535</height> + <height>525</height> </rect> </property> <property name="windowTitle"> @@ -34,6 +34,33 @@ <string>Shortcuts</string> </attribute> <layout class="QGridLayout" name="gridLayout_9"> + <item row="2" column="0"> + <widget class="QCheckBox" name="center_at_startup"> + <property name="text"> + <string>Center at startup</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item row="3" column="0"> + <widget class="QCheckBox" name="trayp"> + <property name="text"> + <string>Minimize to tray</string> + </property> + </widget> + </item> <item row="0" column="0"> <widget class="QGroupBox" name="groupBox_8"> <property name="title"> @@ -62,8 +89,15 @@ <string notr="true">QGroupBox { border: 0; }</string> </property> <layout class="QGridLayout" name="gridLayout_8"> - <item row="0" column="1"> - <widget class="QLabel" name="center_text"> + <item row="6" column="1"> + <widget class="QLabel" name="zero_text"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QLabel" name="toggle_text"> <property name="text"> <string/> </property> @@ -79,17 +113,10 @@ </property> </widget> </item> - <item row="6" column="1"> - <widget class="QLabel" name="zero_text"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="5" column="1"> - <widget class="QLabel" name="toggle_text"> + <item row="0" column="2"> + <widget class="QPushButton" name="bind_center"> <property name="text"> - <string/> + <string>Bind</string> </property> </widget> </item> @@ -113,8 +140,8 @@ </property> </widget> </item> - <item row="0" column="2"> - <widget class="QPushButton" name="bind_center"> + <item row="6" column="2"> + <widget class="QPushButton" name="bind_zero"> <property name="text"> <string>Bind</string> </property> @@ -127,13 +154,85 @@ </property> </widget> </item> - <item row="6" column="2"> - <widget class="QPushButton" name="bind_zero"> + <item row="7" column="0"> + <widget class="QLabel" name="textLabel2_7"> + <property name="text"> + <string>Start tracking</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="center_text"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="8" column="0"> + <widget class="QLabel" name="textLabel2_8"> + <property name="text"> + <string>Stop tracking</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="9" column="0"> + <widget class="QLabel" name="textLabel2_9"> + <property name="text"> + <string>Toggle tracking</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="7" column="2"> + <widget class="QPushButton" name="bind_start"> + <property name="text"> + <string>Bind</string> + </property> + </widget> + </item> + <item row="8" column="2"> + <widget class="QPushButton" name="bind_stop"> <property name="text"> <string>Bind</string> </property> </widget> </item> + <item row="9" column="2"> + <widget class="QPushButton" name="bind_toggle_tracking"> + <property name="text"> + <string>Bind</string> + </property> + </widget> + </item> + <item row="7" column="1"> + <widget class="QLabel" name="start_tracking_text"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="8" column="1"> + <widget class="QLabel" name="stop_tracking_text"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="9" column="1"> + <widget class="QLabel" name="toggle_tracking_text"> + <property name="text"> + <string/> + </property> + </widget> + </item> </layout> </widget> </item> @@ -141,32 +240,45 @@ </widget> </item> <item row="1" column="0"> - <widget class="QCheckBox" name="center_at_startup"> - <property name="text"> - <string>Center at startup</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QCheckBox" name="trayp"> - <property name="text"> - <string>Minimize to tray</string> + <widget class="QGroupBox" name="groupBox_9111"> + <property name="title"> + <string>Centering method</string> </property> + <layout class="QGridLayout" name="gridLayout111"> + <item row="1" column="0"> + <widget class="QLabel" name="label_26"> + <property name="text"> + <string>Method</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="center_method"> + <item> + <property name="text"> + <string>Relative (inertial device)</string> + </property> + </item> + <item> + <property name="text"> + <string>Absolute (camera device)</string> + </property> + </item> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_25"> + <property name="text"> + <string>Try changing this if centering doesn't perform correctly for your input device.</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> </widget> </item> - <item row="3" column="0"> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> </layout> </widget> <widget class="QWidget" name="tab_3"> diff --git a/gui/software-update-dialog.hpp b/gui/software-update-dialog.hpp index fe132402..21d92ecc 100644 --- a/gui/software-update-dialog.hpp +++ b/gui/software-update-dialog.hpp @@ -7,7 +7,7 @@ #include <QRegExp> #include <functional> #include "ui_software-update.h" -#include "opentrack/options.hpp" +#include "opentrack-compat/options.hpp" extern "C" const char* opentrack_version; @@ -8,9 +8,9 @@ #include "ui.h" #include "opentrack/tracker.h" -#include "opentrack/options.hpp" #include "tracker-pt/ftnoir_tracker_pt.h" #include "filter-accela/ftnoir_filter_accela.h" +#include "opentrack-compat/options.hpp" #include "new_file_dialog.h" #include <QFileDialog> #include <QDesktopServices> @@ -24,8 +24,8 @@ MainWindow::MainWindow() : pose_update_timer(this), kbd_quit(QKeySequence("Ctrl+Q"), this), - no_feed_pixmap(":/images/no-feed.png"), is_refreshing_profiles(false), + keys_paused(false), update_query(this) { ui.setupUi(this); @@ -33,7 +33,6 @@ MainWindow::MainWindow() : setFixedSize(size()); updateButtonState(false, false); - ui.video_frame_label->setPixmap(no_feed_pixmap); connect(ui.btnEditCurves, SIGNAL(clicked()), this, SLOT(showCurveConfiguration())); connect(ui.btnShortcuts, SIGNAL(clicked()), this, SLOT(show_options_dialog())); @@ -91,7 +90,23 @@ MainWindow::MainWindow() : "Configuration not saved.", "Can't create configuration directory! Expect major malfunction.", QMessageBox::Ok, QMessageBox::NoButton); - + + connect(this, &MainWindow::emit_start_tracker, + this, [&]() -> void { if (keys_paused) return; qDebug() << "start tracker"; startTracker(); }, + Qt::QueuedConnection); + + connect(this, &MainWindow::emit_stop_tracker, + this, [&]() -> void { if (keys_paused) return; qDebug() << "stop tracker"; stopTracker(); }, + Qt::QueuedConnection); + + connect(this, &MainWindow::emit_toggle_tracker, + this, [&]() -> void { if (keys_paused) return; qDebug() << "toggle tracker"; if (work) stopTracker(); else startTracker(); }, + Qt::QueuedConnection); + + register_shortcuts(); + + connect(this, &MainWindow::emit_minimized, this, &MainWindow::mark_minimized, Qt::QueuedConnection); + ui.btnStartTracker->setFocus(); update_query.maybe_show_dialog(); @@ -105,6 +120,22 @@ void MainWindow::closeEvent(QCloseEvent *e) e->accept(); } +void MainWindow::register_shortcuts() +{ + using t_shortcut = std::tuple<key_opts&, Shortcuts::fun>; + + std::vector<t_shortcut> keys { + t_shortcut(s.key_start_tracking, [&]() -> void { emit_start_tracker(); }), + t_shortcut(s.key_stop_tracking, [&]() -> void { emit_stop_tracker(); }), + t_shortcut(s.key_toggle_tracking, [&]() -> void { emit_toggle_tracker(); }), + }; + + global_shortcuts.reload(keys); + + if (work) + work->reload_shortcuts(); +} + bool MainWindow::get_new_config_name_from_dialog(QString& ret) { new_file_dialog dlg; @@ -252,6 +283,9 @@ void MainWindow::reload_options() } void MainWindow::startTracker() { + if (work) + return; + // tracker dtor needs run first work = nullptr; @@ -272,7 +306,7 @@ void MainWindow::startTracker() { return; } - work = std::make_shared<Work>(s, pose, libs, this, winId()); + work = std::make_shared<Work>(s, pose, libs, winId()); reload_options(); @@ -291,7 +325,10 @@ void MainWindow::startTracker() { ui.btnStopTracker->setFocus(); } -void MainWindow::stopTracker( ) { +void MainWindow::stopTracker() { + if (!work) + return; + //ui.game_name->setText("Not connected"); pose_update_timer.stop(); @@ -361,6 +398,9 @@ void MainWindow::set_title(const QString& game_title_) void MainWindow::showHeadPose() { + if (!ui.video_frame->isEnabled()) + return; + double mapped[6], raw[6]; work->tracker->get_raw_and_mapped_poses(mapped, raw); @@ -386,7 +426,6 @@ bool mk_dialog(mem<dylib> lib, mem<t>* orig) *orig = dialog; dialog->show(); - dialog->raise(); return true; } @@ -398,7 +437,7 @@ void MainWindow::showProtocolSettings() { pProtocolDialog->register_protocol(libs.pProtocol.get()); } template<typename t, typename... Args> -bool mk_window(mem<t>* place, Args... params) +bool mk_window(mem<t>* place, Args&&... params) { if (*place && (*place)->isVisible()) { @@ -408,21 +447,24 @@ bool mk_window(mem<t>* place, Args... params) } else { - *place = std::make_shared<t>(params...); + *place = std::make_shared<t>(std::forward<Args>(params)...); (*place)->setWindowFlags(Qt::Dialog); (*place)->show(); - (*place)->raise(); return true; } } void MainWindow::show_options_dialog() { - if (mk_window<OptionsDialog, State&>(&options_widget, static_cast<State&>(*this))) + if (mk_window(&options_widget, + s, + *this, + [&]() -> void { register_shortcuts(); }, + [&](bool flag) -> void { keys_paused = flag; })) connect(options_widget.get(), SIGNAL(reload()), this, SLOT(reload_options())); } void MainWindow::showCurveConfiguration() { - mk_window<MapWidget, Mappings&, main_settings&>(&mapping_widget, pose, s); + mk_window(&mapping_widget, pose, s); } bool MainWindow::maybe_not_close_tracking() @@ -468,27 +510,6 @@ void MainWindow::profileSelected(QString name) } } -void MainWindow::shortcutRecentered() -{ - qDebug() << "Center"; - if (work) - work->tracker->center(); -} - -void MainWindow::shortcutToggled() -{ - qDebug() << "Toggle"; - if (work) - work->tracker->toggle_enabled(); -} - -void MainWindow::shortcutZeroed() -{ - qDebug() << "Zero"; - if (work) - work->tracker->zero(); -} - void MainWindow::ensure_tray() { if (tray) @@ -512,15 +533,28 @@ void MainWindow::restore_from_tray(QSystemTrayIcon::ActivationReason) void MainWindow::changeEvent(QEvent* e) { - if (s.tray_enabled && e->type() == QEvent::WindowStateChange && (windowState() & Qt::WindowMinimized)) + if (e->type() == QEvent::WindowStateChange) { - if (!tray) - ensure_tray(); - hide(); + const bool is_minimized = windowState() & Qt::WindowMinimized; + + if (s.tray_enabled && is_minimized) + { + if (!tray) + ensure_tray(); + hide(); + } + + emit_minimized(is_minimized); } + QMainWindow::changeEvent(e); } +void MainWindow::mark_minimized(bool is_minimized) +{ + ui.video_frame->setEnabled(!is_minimized); +} + void MainWindow::maybe_start_profile_from_executable() { if (!work) @@ -17,9 +17,12 @@ #include <QString> #include <QMenu> +#include <vector> +#include <tuple> + #include "ui_main.h" -#include "opentrack/options.hpp" +#include "opentrack-compat/options.hpp" #include "opentrack/main-settings.hpp" #include "opentrack/plugin-support.hpp" #include "opentrack/tracker.h" @@ -33,9 +36,11 @@ using namespace options; -class MainWindow : public QMainWindow, private State +class MainWindow : public QMainWindow, public State { Q_OBJECT + + Shortcuts global_shortcuts; Ui::OpentrackUI ui; mem<QSystemTrayIcon> tray; @@ -45,11 +50,11 @@ class MainWindow : public QMainWindow, private State mem<OptionsDialog> options_widget; mem<MapWidget> mapping_widget; QShortcut kbd_quit; - QPixmap no_feed_pixmap; mem<IProtocolDialog> pProtocolDialog; process_detector_worker det; QMenu profile_menu; bool is_refreshing_profiles; + volatile bool keys_paused; QTimer save_timer; update_dialog::query update_query; @@ -70,6 +75,7 @@ class MainWindow : public QMainWindow, private State void maybe_save(); bool maybe_not_close_tracking(); void closeEvent(QCloseEvent *e) override; + void register_shortcuts(); private slots: void _save(); void save(); @@ -92,10 +98,13 @@ private slots: void startTracker(); void stopTracker(); void reload_options(); -public slots: - void shortcutRecentered(); - void shortcutToggled(); - void shortcutZeroed(); + void mark_minimized(bool is_minimized); +signals: + void emit_start_tracker(); + void emit_stop_tracker(); + void emit_toggle_tracker(); + + void emit_minimized(bool); public: MainWindow(); ~MainWindow(); diff --git a/gui/wizard.h b/gui/wizard.h index ea848e36..9d359172 100644 --- a/gui/wizard.h +++ b/gui/wizard.h @@ -1,6 +1,6 @@ #pragma once -#include "opentrack/options.hpp" +#include "opentrack-compat/options.hpp" #include "opentrack/main-settings.hpp" #include "opentrack/mappings.hpp" #include "ui_trackhat-wizard.h" |