diff options
Diffstat (limited to 'facetracknoir')
-rw-r--r-- | facetracknoir/curve-config.cpp | 36 | ||||
-rw-r--r--[-rwxr-xr-x] | facetracknoir/keyboard.h | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | facetracknoir/main.ui | 1954 | ||||
-rw-r--r-- | facetracknoir/new_config.ui | 45 | ||||
-rw-r--r-- | facetracknoir/new_file_dialog.h | 50 | ||||
-rw-r--r-- | facetracknoir/process_detector.cpp | 34 | ||||
-rw-r--r-- | facetracknoir/process_detector.h | 17 | ||||
-rw-r--r-- | facetracknoir/ui.cpp | 273 | ||||
-rw-r--r-- | facetracknoir/ui.h | 68 |
9 files changed, 1113 insertions, 1364 deletions
diff --git a/facetracknoir/curve-config.cpp b/facetracknoir/curve-config.cpp index e199d005..2e9065b4 100644 --- a/facetracknoir/curve-config.cpp +++ b/facetracknoir/curve-config.cpp @@ -20,23 +20,24 @@ MapWidget::MapWidget(Mappings& m, main_settings& s) : struct { QFunctionConfigurator* qfc; Axis axis; + QCheckBox* checkbox; bool altp; } qfcs[] = { - { ui.rxconfig, Yaw, false }, - { ui.ryconfig, Pitch, false}, - { ui.rzconfig, Roll, false }, - { ui.txconfig, TX, false }, - { ui.tyconfig, TY, false }, - { ui.tzconfig, TZ, false }, + { ui.rxconfig, Yaw, nullptr, false }, + { ui.ryconfig, Pitch, nullptr, false }, + { ui.rzconfig, Roll, nullptr, false }, + { ui.txconfig, TX, nullptr, false }, + { ui.tyconfig, TY, nullptr, false }, + { ui.tzconfig, TZ, nullptr, false }, - { ui.rxconfig_alt, Yaw, true }, - { ui.ryconfig_alt, Pitch, true}, - { ui.rzconfig_alt, Roll, true }, - { ui.txconfig_alt, TX, true }, - { ui.tyconfig_alt, TY, true }, - { ui.tzconfig_alt, TZ, true }, - { nullptr, Yaw, false } + { ui.rxconfig_alt, Yaw, ui.rx_altp, true }, + { ui.ryconfig_alt, Pitch, ui.ry_altp, true }, + { ui.rzconfig_alt, Roll, ui.rz_altp, true }, + { ui.txconfig_alt, TX, ui.tx_altp, true }, + { ui.tyconfig_alt, TY, ui.ty_altp, true }, + { ui.tzconfig_alt, TZ, ui.tz_altp, true }, + { nullptr, Yaw, nullptr, false } }; for (int i = 0; qfcs[i].qfc; i++) @@ -45,7 +46,14 @@ MapWidget::MapWidget(Mappings& m, main_settings& s) : Mapping& axis = m(qfcs[i].axis); Map* conf = altp ? &axis.curveAlt : &axis.curve; const auto& name = qfcs[i].altp ? axis.name2 : axis.name1; - + if (altp) + { + QFunctionConfigurator& qfc = *qfcs[i].qfc; + connect(qfcs[i].checkbox, &QCheckBox::toggled, + [&](bool f) -> void {qfc.setEnabled(f); qfc.force_redraw();}); + qfc.setEnabled(qfcs[i].checkbox->isChecked()); + qfc.force_redraw(); + } qfcs[i].qfc->setConfig(conf, name); } } diff --git a/facetracknoir/keyboard.h b/facetracknoir/keyboard.h index 3df295e1..3df295e1 100755..100644 --- a/facetracknoir/keyboard.h +++ b/facetracknoir/keyboard.h diff --git a/facetracknoir/main.ui b/facetracknoir/main.ui index 4d8b6caf..f852abff 100755..100644 --- a/facetracknoir/main.ui +++ b/facetracknoir/main.ui @@ -7,8 +7,8 @@ <rect> <x>0</x> <y>0</y> - <width>744</width> - <height>473</height> + <width>693</width> + <height>530</height> </rect> </property> <property name="windowIcon"> @@ -31,25 +31,19 @@ <number>0</number> </property> <property name="leftMargin"> - <number>6</number> + <number>0</number> </property> <property name="topMargin"> <number>0</number> </property> <property name="rightMargin"> - <number>6</number> + <number>0</number> </property> <property name="bottomMargin"> - <number>10</number> + <number>0</number> </property> <item> <widget class="QFrame" name="frame"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> @@ -59,7 +53,7 @@ <property name="lineWidth"> <number>0</number> </property> - <layout class="QGridLayout" name="gridLayout"> + <layout class="QGridLayout" name="gridLayout_5"> <property name="leftMargin"> <number>0</number> </property> @@ -75,15 +69,15 @@ <property name="spacing"> <number>0</number> </property> - <item row="0" column="0" colspan="2"> - <widget class="QFrame" name="frame_2"> + <item row="0" column="0"> + <widget class="QFrame" name="top"> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <layout class="QGridLayout" name="gridLayout_2"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="spacing"> + <number>0</number> + </property> <property name="leftMargin"> <number>0</number> </property> @@ -96,127 +90,436 @@ <property name="bottomMargin"> <number>0</number> </property> - <property name="spacing"> - <number>0</number> - </property> - <item row="1" column="0"> - <widget class="QFrame" name="frame_3"> + <item> + <widget class="QFrame" name="video_feed"> <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <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> + </size> + </property> + <widget class="QFrame" name="video_frame"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>480</width> + <height>360</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <widget class="QLabel" name="video_frame_label"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>480</width> + <height>360</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <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> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </widget> + </widget> + </item> + <item> + <widget class="QFrame" name="top_display"> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> + <property name="lineWidth"> + <number>0</number> </property> - <layout class="QHBoxLayout" name="horizontalLayout_2"> + <layout class="QVBoxLayout"> <property name="spacing"> - <number>9</number> + <number>12</number> </property> <property name="leftMargin"> - <number>0</number> + <number>6</number> </property> <property name="topMargin"> - <number>6</number> + <number>12</number> </property> <property name="rightMargin"> - <number>0</number> + <number>8</number> </property> <property name="bottomMargin"> - <number>0</number> + <number>4</number> </property> <item> - <widget class="QGroupBox" name="groupProfile"> + <widget class="GLWidget" name="pose_display" native="true"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>10</horstretch> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="title"> - <string>Profile</string> + <property name="maximumSize"> + <size> + <width>80</width> + <height>90</height> + </size> + </property> + </widget> + </item> + <item> + <widget class="QGroupBox" name="box_raw_headpose"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="flat"> - <bool>true</bool> + <property name="title"> + <string notr="true">Raw tracker data</string> </property> - <layout class="QGridLayout" name="gridLayout_7"> + <layout class="QGridLayout" name="gridLayout_12"> <property name="leftMargin"> <number>0</number> </property> <property name="topMargin"> - <number>13</number> + <number>0</number> </property> <property name="rightMargin"> - <number>4</number> + <number>0</number> </property> <property name="bottomMargin"> <number>0</number> </property> <property name="horizontalSpacing"> - <number>8</number> + <number>3</number> </property> <property name="verticalSpacing"> - <number>7</number> + <number>2</number> </property> - <item row="0" column="0"> - <widget class="QComboBox" name="iconcomboProfile"> + <item row="0" column="1"> + <widget class="QLCDNumber" name="raw_x"> + <property name="enabled"> + <bool>true</bool> + </property> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>7</horstretch> - <verstretch>5</verstretch> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> </sizepolicy> </property> - <property name="maxVisibleItems"> - <number>10</number> + <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="1"> - <widget class="QToolButton" name="btnSave"> + <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="Expanding" vsizetype="Preferred"> - <horstretch>3</horstretch> - <verstretch>5</verstretch> + <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>Save</string> + <string>TZ</string> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QToolButton" name="btnLoad"> + <item row="1" column="2"> + <widget class="QLabel" name="lblRotY_4"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>7</horstretch> - <verstretch>4</verstretch> + <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>Load</string> + <string>pitch</string> </property> </widget> </item> <item row="1" column="1"> - <widget class="QToolButton" name="btnSaveAs"> + <widget class="QLCDNumber" name="raw_y"> <property name="enabled"> <bool>true</bool> </property> <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>3</horstretch> - <verstretch>4</verstretch> + <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"> + <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> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> <property name="text"> - <string>Save...</string> + <string>TY</string> </property> </widget> </item> @@ -224,230 +527,291 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupStartStop"> + <widget class="QGroupBox" name="box_mapped_headpose"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> - <horstretch>7</horstretch> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum"> + <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="title"> - <string notr="true">Controls</string> + <string notr="true">Game data</string> </property> - <property name="flat"> - <bool>true</bool> - </property> - <layout class="QGridLayout" name="gridLayout_5"> + <layout class="QGridLayout" name="gridLayout_14"> <property name="leftMargin"> - <number>4</number> + <number>0</number> </property> <property name="topMargin"> - <number>14</number> + <number>0</number> </property> <property name="rightMargin"> - <number>4</number> + <number>0</number> </property> <property name="bottomMargin"> - <number>10</number> + <number>0</number> </property> <property name="horizontalSpacing"> - <number>6</number> + <number>3</number> </property> <property name="verticalSpacing"> - <number>0</number> + <number>2</number> </property> - <item row="0" column="1"> - <widget class="QToolButton" name="btnStopTracker"> + <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="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="1" column="2"> + <widget class="QLabel" name="lblRotY_2"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="maximumSize"> - <size> - <width>16777215</width> - <height>45</height> - </size> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> </property> <property name="text"> - <string>Stop</string> + <string>pitch</string> </property> </widget> </item> - <item row="0" column="0"> - <widget class="QToolButton" name="btnStartTracker"> + <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="Preferred" vsizetype="Minimum"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="maximumSize"> - <size> - <width>16777215</width> - <height>45</height> - </size> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> </property> <property name="text"> - <string>Start</string> + <string>yaw</string> </property> </widget> </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupWindows"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="styleSheet"> - <string notr="true">QGroupBox { border: 0; }</string> - </property> - <layout class="QGridLayout" name="gridLayout_10"> - <property name="bottomMargin"> - <number>4</number> - </property> - <item row="0" column="0"> - <widget class="QGroupBox" name="groupGameProtocol"> + <item row="2" column="2"> + <widget class="QLabel" name="lblRotZ_2"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="title"> - <string>Protocol</string> + <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_2"> + <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="flat"> + <property name="autoFillBackground"> <bool>false</bool> </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="spacing"> - <number>5</number> - </property> - <property name="leftMargin"> - <number>2</number> - </property> - <property name="topMargin"> - <number>18</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QComboBox" name="iconcomboProtocol"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="btnShowServerControls"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>...</string> - </property> - <property name="flat" stdset="0"> - <bool>false</bool> - </property> - </widget> - </item> - </layout> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>TZ</string> + </property> </widget> </item> - <item row="1" column="0"> - <widget class="QFrame" name="frame_7"> + <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="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> + </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::StyledPanel</enum> + <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="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="frameShadow"> <enum>QFrame::Raised</enum> </property> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <property name="spacing"> - <number>8</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>2</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QPushButton" name="btnEditCurves"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Mapping</string> - </property> - <property name="icon"> - <iconset resource="ui-res.qrc"> - <normaloff>:/images/curves.png</normaloff>:/images/curves.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>80</width> - <height>24</height> - </size> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnShortcuts"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Options</string> - </property> - <property name="icon"> - <iconset resource="ui-res.qrc"> - <normaloff>:/images/tools.png</normaloff>:/images/tools.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>80</width> - <height>24</height> - </size> - </property> - </widget> - </item> - </layout> + <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> </layout> @@ -456,940 +820,282 @@ </layout> </widget> </item> - <item row="0" column="0"> - <widget class="QFrame" name="frame_6"> - <property name="frameShape"> - <enum>QFrame::StyledPanel</enum> + </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"> + <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="frameShadow"> - <enum>QFrame::Raised</enum> + <property name="flat"> + <bool>true</bool> </property> - <layout class="QGridLayout" name="gridLayout_9"> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <property name="spacing"> + <number>3</number> + </property> <property name="leftMargin"> - <number>0</number> + <number>4</number> </property> <property name="topMargin"> - <number>0</number> + <number>2</number> </property> <property name="rightMargin"> <number>0</number> </property> <property name="bottomMargin"> - <number>0</number> - </property> - <property name="horizontalSpacing"> <number>6</number> </property> - <item row="0" column="0"> - <widget class="QFrame" name="video_feed"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <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> - </size> + <item> + <widget class="QGroupBox" name="groupGameProtocol"> + <property name="title"> + <string>Protocol</string> </property> - <widget class="QFrame" name="video_frame"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>480</width> - <height>360</height> - </rect> + <layout class="QGridLayout" name="gridLayout_4"> + <property name="leftMargin"> + <number>4</number> </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>4</number> </property> - <widget class="QLabel" name="video_frame_label"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>480</width> - <height>360</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <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> - </size> - </property> - <property name="text"> - <string/> - </property> - </widget> - </widget> + <property name="bottomMargin"> + <number>0</number> + </property> + <property name="horizontalSpacing"> + <number>3</number> + </property> + <property name="verticalSpacing"> + <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 row="0" column="1"> - <widget class="QFrame" name="top_display_3"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="lineWidth"> - <number>0</number> + <item> + <widget class="QFrame" name="groupProfile"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>2</verstretch> + </sizepolicy> </property> - <layout class="QVBoxLayout" name="_3"> + <layout class="QHBoxLayout" name="horizontalLayout"> <property name="spacing"> - <number>12</number> - </property> - <property name="leftMargin"> <number>0</number> </property> - <property name="topMargin"> + <property name="leftMargin"> <number>0</number> </property> <property name="rightMargin"> - <number>0</number> + <number>2</number> </property> <property name="bottomMargin"> - <number>0</number> + <number>2</number> </property> <item> - <widget class="GLWidget" name="pose_display" native="true"> + <widget class="QToolButton" name="profile_button"> + <property name="enabled"> + <bool>true</bool> + </property> <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>110</height> - </size> + <property name="text"> + <string>Profile</string> </property> - </widget> - </item> - <item> - <widget class="QGroupBox" name="box_raw_headpose_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <property name="popupMode"> + <enum>QToolButton::InstantPopup</enum> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + <property name="arrowType"> + <enum>Qt::DownArrow</enum> </property> - <property name="title"> - <string notr="true">Raw tracker data</string> - </property> - <layout class="QGridLayout" name="gridLayout_16"> - <property name="leftMargin"> - <number>4</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="horizontalSpacing"> - <number>3</number> - </property> - <property name="verticalSpacing"> - <number>2</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>5</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>88</width> - <height>35</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>88</width> - <height>35</height> - </size> - </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_6"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>2</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>yaw</string> - </property> - <property name="margin"> - <number>6</number> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="lblRotZ_6"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>2</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>roll</string> - </property> - <property name="margin"> - <number>6</number> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="lblZ_6"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>2</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>Z</string> - </property> - <property name="margin"> - <number>6</number> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="lblRotY_6"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>2</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>pitch</string> - </property> - <property name="margin"> - <number>6</number> - </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>5</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>88</width> - <height>34</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>88</width> - <height>34</height> - </size> - </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>5</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>88</width> - <height>35</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>88</width> - <height>35</height> - </size> - </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>5</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>88</width> - <height>35</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>88</width> - <height>35</height> - </size> - </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>5</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>88</width> - <height>35</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>88</width> - <height>35</height> - </size> - </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_6"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>2</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>X</string> - </property> - <property name="margin"> - <number>6</number> - </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>5</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>88</width> - <height>34</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>88</width> - <height>34</height> - </size> - </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_6"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>2</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>Y</string> - </property> - <property name="margin"> - <number>6</number> - </property> - </widget> - </item> - </layout> </widget> </item> <item> - <widget class="QGroupBox" name="box_mapped_headpose_3"> + <widget class="QComboBox" name="iconcomboProfile"> <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="title"> - <string notr="true">Game data</string> - </property> - <layout class="QGridLayout" name="gridLayout_17"> - <property name="leftMargin"> - <number>4</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="horizontalSpacing"> - <number>3</number> - </property> - <property name="verticalSpacing"> - <number>2</number> - </property> - <item row="1" column="0"> - <widget class="QLabel" name="lblY_7"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>2</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>Y</string> - </property> - <property name="margin"> - <number>6</number> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="lblRotY_7"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>2</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>pitch</string> - </property> - <property name="margin"> - <number>6</number> - </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>5</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>88</width> - <height>35</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>88</width> - <height>35</height> - </size> - </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_7"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>2</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>yaw</string> - </property> - <property name="margin"> - <number>6</number> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="lblRotZ_7"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>2</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>roll</string> - </property> - <property name="margin"> - <number>6</number> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="lblZ_7"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>2</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>Z</string> - </property> - <property name="margin"> - <number>6</number> - </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>5</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>88</width> - <height>34</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>88</width> - <height>34</height> - </size> - </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>5</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>88</width> - <height>35</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>88</width> - <height>35</height> - </size> - </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>5</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>88</width> - <height>35</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>88</width> - <height>35</height> - </size> - </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>5</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>88</width> - <height>35</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>88</width> - <height>35</height> - </size> - </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_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>2</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>X</string> - </property> - <property name="margin"> - <number>6</number> - </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>5</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>88</width> - <height>34</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>88</width> - <height>34</height> - </size> - </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> + <property name="maxVisibleItems"> + <number>20</number> + </property> </widget> </item> </layout> </widget> </item> + <item> + <widget class="QPushButton" name="btnEditCurves"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>3</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Mapping</string> + </property> + <property name="icon"> + <iconset resource="ui-res.qrc"> + <normaloff>:/images/curves.png</normaloff>:/images/curves.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>80</width> + <height>24</height> + </size> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="btnShortcuts"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>3</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Options</string> + </property> + <property name="icon"> + <iconset resource="ui-res.qrc"> + <normaloff>:/images/tools.png</normaloff>:/images/tools.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>80</width> + <height>24</height> + </size> + </property> + </widget> + </item> + </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> @@ -1410,8 +1116,12 @@ </customwidget> </customwidgets> <tabstops> + <tabstop>btnStartTracker</tabstop> + <tabstop>btnStopTracker</tabstop> <tabstop>iconcomboProtocol</tabstop> <tabstop>btnShowServerControls</tabstop> + <tabstop>btnEditCurves</tabstop> + <tabstop>btnShortcuts</tabstop> </tabstops> <resources> <include location="ui-res.qrc"/> diff --git a/facetracknoir/new_config.ui b/facetracknoir/new_config.ui new file mode 100644 index 00000000..27dce0f8 --- /dev/null +++ b/facetracknoir/new_config.ui @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UI_new_config</class> + <widget class="QDialog" name="UI_new_config"> + <property name="windowModality"> + <enum>Qt::ApplicationModal</enum> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>269</width> + <height>67</height> + </rect> + </property> + <property name="windowTitle"> + <string>Config filename</string> + </property> + <property name="windowIcon"> + <iconset> + <normaloff>images/facetracknoir.png</normaloff>images/facetracknoir.png</iconset> + </property> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>New file name:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="lineEdit"/> + </item> + <item row="1" column="1"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/facetracknoir/new_file_dialog.h b/facetracknoir/new_file_dialog.h new file mode 100644 index 00000000..3a35cf71 --- /dev/null +++ b/facetracknoir/new_file_dialog.h @@ -0,0 +1,50 @@ +#pragma once + +#include "ui_new_config.h" +#include "opentrack/options.hpp" +#include <QFile> +#include <QRegExp> +#include <QString> +#include <QMessageBox> + +class new_file_dialog : public QDialog +{ + Q_OBJECT +public: + new_file_dialog(QWidget* parent = 0) : QDialog(parent), ok(false) + { + ui.setupUi(this); + connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(ok_clicked())); + connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(cancel_clicked())); + setFixedSize(size()); + } + bool is_ok(QString& name_) + { + name_ = name; + return ok; + } +private: + Ui::UI_new_config ui; + bool ok; + QString name; +private slots: + void cancel_clicked() { close(); } + void ok_clicked() + { + QString text = ui.lineEdit->text(); + text = text.replace('/', ""); + text = text.replace('\\', ""); + if (text != "" && !text.endsWith(".ini")) + text += ".ini"; + if (text == "" || text == ".ini" || QFile(options::group::ini_directory() + "/" + text).exists()) + { + QMessageBox::warning(this, + "File exists", "This file already exists. Pick another name.", + QMessageBox::Ok, QMessageBox::NoButton); + return; + } + ok = true; + close(); + name = text; + } +}; diff --git a/facetracknoir/process_detector.cpp b/facetracknoir/process_detector.cpp index df38eb29..19611241 100644 --- a/facetracknoir/process_detector.cpp +++ b/facetracknoir/process_detector.cpp @@ -8,6 +8,7 @@ #include "process_detector.h" #include "facetracknoir/ui.h" +#include "opentrack-compat/process-list.hpp" #include <QList> #include <QFileDialog> #include <QComboBox> @@ -153,36 +154,6 @@ void process_detector::remove() ui.tableWidget->removeRow(r); } -#ifdef _WIN32 - -#include <windows.h> -#include <TlHelp32.h> - -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; -} - bool process_detector_worker::should_stop() { if (last_exe_name == "") @@ -237,6 +208,3 @@ bool process_detector_worker::config_to_start(QString& str) return false; } - - -#endif diff --git a/facetracknoir/process_detector.h b/facetracknoir/process_detector.h index 792a941f..f6497c90 100644 --- a/facetracknoir/process_detector.h +++ b/facetracknoir/process_detector.h @@ -74,8 +74,6 @@ public slots: void browse(); }; -#ifdef _WIN32 - class process_detector_worker : QObject { Q_OBJECT @@ -86,18 +84,3 @@ public: bool should_stop(); }; -#else - -class process_detector_worker : QObject -{ - Q_OBJECT -public: - bool config_to_start(QString&) - { - return false; - } - bool should_stop() { return false; } - -}; - -#endif diff --git a/facetracknoir/ui.cpp b/facetracknoir/ui.cpp index 4f1d8c18..15fdd308 100644 --- a/facetracknoir/ui.cpp +++ b/facetracknoir/ui.cpp @@ -1,27 +1,3 @@ -/******************************************************************************* -* FaceTrackNoIR This program is a private project of the some enthusiastic -* gamers from Holland, who don't like to pay much for -* head-tracking. -* -* Copyright (C) 2011 Wim Vriend (Developing) -* Ron Hendriks (Researching and Testing) -* -* Homepage -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation; either version 3 of the License, or (at your -* option) any later version. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, see <http://www.gnu.org/licenses/>. -*********************************************************************************/ - /* Copyright (c) 2013-2015, Stanislaw Halik <sthalik@misaki.pl> * Permission to use, copy, modify, and/or distribute this @@ -35,8 +11,9 @@ #include "opentrack/options.hpp" #include "ftnoir_tracker_pt/ftnoir_tracker_pt.h" #include "ftnoir_filter_accela/ftnoir_filter_accela.h" +#include "facetracknoir/new_file_dialog.h" #include <QFileDialog> -#include <QFileInfo> +#include <QDesktopServices> #ifndef _WIN32 # include <unistd.h> @@ -47,7 +24,8 @@ MainWindow::MainWindow() : pose_update_timer(this), kbd_quit(QKeySequence("Ctrl+Q"), this), - no_feed_pixmap(":/images/no-feed.png") + no_feed_pixmap(":/images/no-feed.png"), + is_refreshing_profiles(false) { ui.setupUi(this); @@ -56,43 +34,80 @@ MainWindow::MainWindow() : updateButtonState(false, false); ui.video_frame_label->setPixmap(no_feed_pixmap); - connect(ui.btnLoad, SIGNAL(clicked()), this, SLOT(open())); - connect(ui.btnSave, SIGNAL(clicked()), this, SLOT(save())); - connect(ui.btnSaveAs, SIGNAL(clicked()), this, SLOT(saveAs())); - connect(ui.btnEditCurves, SIGNAL(clicked()), this, SLOT(showCurveConfiguration())); connect(ui.btnShortcuts, SIGNAL(clicked()), this, SLOT(showKeyboardShortcuts())); + connect(ui.btnShortcuts, SIGNAL(clicked()), this, SLOT(show_options_dialog())); connect(ui.btnShowServerControls, SIGNAL(clicked()), this, SLOT(showProtocolSettings())); for (auto x : modules.protocols()) ui.iconcomboProtocol->addItem(x->icon, x->name); - fill_profile_combobox(); + refresh_config_list(); + connect(&config_list_timer, SIGNAL(timeout()), this, SLOT(refresh_config_list())); + config_list_timer.start(1000 * 3); tie_setting(s.protocol_dll, ui.iconcomboProtocol); + connect(ui.iconcomboProtocol, + &QComboBox::currentTextChanged, + [&](QString) -> void { if (pProtocolDialog) pProtocolDialog = nullptr; save(); }); + connect(ui.btnStartTracker, SIGNAL(clicked()), this, SLOT(startTracker())); connect(ui.btnStopTracker, SIGNAL(clicked()), this, SLOT(stopTracker())); - connect(ui.iconcomboProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(profileSelected(int))); + connect(ui.iconcomboProfile, SIGNAL(currentTextChanged(QString)), this, SLOT(profileSelected(QString))); connect(&pose_update_timer, SIGNAL(timeout()), this, SLOT(showHeadPose())); connect(&kbd_quit, SIGNAL(activated()), this, SLOT(exit())); + + save_timer.setSingleShot(true); + connect(&save_timer, SIGNAL(timeout()), this, SLOT(_save())); + + profile_menu.addAction("Create new empty config", this, SLOT(make_empty_config())); + profile_menu.addAction("Create new copied config", this, SLOT(make_copied_config())); + profile_menu.addAction("Open configuration directory", this, SLOT(open_config_directory())); + ui.profile_button->setMenu(&profile_menu); + kbd_quit.setEnabled(true); connect(&det_timer, SIGNAL(timeout()), this, SLOT(maybe_start_profile_from_executable())); det_timer.start(1000); ensure_tray(); - set_working_directory(); + + if (!QFile(group::ini_pathname()).exists()) + { + set_profile(OPENTRACK_DEFAULT_CONFIG); + const auto pathname = group::ini_pathname(); + if (!QFile(pathname).exists()) + { + QFile file(pathname); + (void) file.open(QFile::ReadWrite); + } + } + + if (group::ini_directory() == "") + QMessageBox::warning(this, + "Configuration not saved.", + "Can't create configuration directory! Expect major malfunction.", + QMessageBox::Ok, QMessageBox::NoButton); +} + +bool MainWindow::get_new_config_name_from_dialog(QString& ret) +{ + new_file_dialog dlg; + dlg.exec(); + return dlg.is_ok(ret); } MainWindow::~MainWindow() { + save_timer.stop(); + if (tray) tray->hide(); stopTracker(); - save(); + maybe_save(); } void MainWindow::set_working_directory() @@ -100,32 +115,26 @@ void MainWindow::set_working_directory() QDir::setCurrent(QCoreApplication::applicationDirPath()); } -void MainWindow::open() { - QFileDialog dialog(this); - dialog.setFileMode(QFileDialog::ExistingFile); - QString dir_path = QFileInfo(group::ini_pathname()).absolutePath(); - QString fileName = dialog.getOpenFileName( - this, - tr("Open the settings file"), - dir_path, - tr("Settings file (*.ini);;All Files (*)")); - set_working_directory(); +void MainWindow::save_mappings() { + pose.save_mappings(); +} - if (!fileName.isEmpty()) { - { - QSettings settings(OPENTRACK_ORG); - settings.setValue(OPENTRACK_CONFIG_FILENAME_KEY, remove_app_path(fileName)); - } - fill_profile_combobox(); - load_settings(); - } +void MainWindow::save() +{ + save_timer.stop(); + save_timer.start(5000); } -void MainWindow::save_mappings() { - pose.save_mappings(); +void MainWindow::maybe_save() +{ + if (save_timer.isActive()) + { + save_timer.stop(); + _save(); + } } -void MainWindow::save() { +void MainWindow::_save() { s.b->save(); save_mappings(); mem<QSettings> settings = group::ini_file(); @@ -143,29 +152,6 @@ void MainWindow::save() { #endif } -void MainWindow::saveAs() -{ - QString oldFile = group::ini_pathname(); - QString fileName = QFileDialog::getSaveFileName(this, tr("Save file"), - oldFile, - tr("Settings file (*.ini);;All Files (*)")); - set_working_directory(); - - if (fileName.isEmpty()) - return; - - (void) QFile::remove(fileName); - - { - (void) QFile::copy(oldFile, fileName); - QSettings settings(OPENTRACK_ORG); - settings.setValue (OPENTRACK_CONFIG_FILENAME_KEY, remove_app_path(fileName)); - } - - save(); - fill_profile_combobox(); -} - void MainWindow::load_mappings() { pose.load_mappings(); } @@ -175,16 +161,64 @@ void MainWindow::load_settings() { load_mappings(); } +void MainWindow::make_empty_config() +{ + QString name; + const QString dir = group::ini_directory(); + if (dir != "" && get_new_config_name_from_dialog(name)) + { + QFile filename(dir + "/" + name); + (void) filename.open(QFile::ReadWrite); + refresh_config_list(); + ui.iconcomboProfile->setCurrentText(name); + } +} + +void MainWindow::make_copied_config() +{ + const QString dir = group::ini_directory(); + const QString cur = group::ini_pathname(); + QString name; + if (cur != "" && dir != "" && get_new_config_name_from_dialog(name)) + { + const QString new_name = dir + "/" + name; + (void) QFile::remove(new_name); + (void) QFile::copy(cur, new_name); + refresh_config_list(); + ui.iconcomboProfile->setCurrentText(name); + } +} + +void MainWindow::open_config_directory() +{ + const QString path = group::ini_directory(); + if (path != "") + { + QDesktopServices::openUrl("file:///" + QDir::toNativeSeparators(path)); + } +} + extern "C" volatile const char* opentrack_version; -void MainWindow::fill_profile_combobox() +void MainWindow::refresh_config_list() { + if (work) + return; + + if (group::ini_list().size() == 0) + { + QFile filename(group::ini_directory() + "/" OPENTRACK_DEFAULT_CONFIG); + (void) filename.open(QFile::ReadWrite); + } + QStringList ini_list = group::ini_list(); set_title(); - QString current = QFileInfo(group::ini_pathname()).fileName(); + QString current = group::ini_filename(); + is_refreshing_profiles = true; ui.iconcomboProfile->clear(); for (auto x : ini_list) ui.iconcomboProfile->addItem(QIcon(":/images/settings16.png"), x); + is_refreshing_profiles = false; ui.iconcomboProfile->setCurrentText(current); } @@ -196,11 +230,10 @@ void MainWindow::updateButtonState(bool running, bool inertialp) ui.btnStopTracker->setEnabled ( running ); ui.iconcomboProtocol->setEnabled ( not_running ); ui.video_frame_label->setVisible(not_running || inertialp); - ui.btnSaveAs->setEnabled(not_running); - ui.btnLoad->setEnabled(not_running); + ui.profile_button->setEnabled(not_running); } -void MainWindow::bindKeyboardShortcuts() +void MainWindow::reload_options() { if (work) work->reload_shortcuts(); @@ -208,9 +241,6 @@ void MainWindow::bindKeyboardShortcuts() } void MainWindow::startTracker() { - s.b->save(); - load_settings(); - // tracker dtor needs run first work = nullptr; @@ -233,8 +263,8 @@ void MainWindow::startTracker() { work = std::make_shared<Work>(s, pose, libs, this, winId()); - bindKeyboardShortcuts(); - + reload_options(); + if (pProtocolDialog) pProtocolDialog->register_protocol(libs.pProtocol.get()); @@ -244,6 +274,8 @@ void MainWindow::startTracker() { // trackers take care of layout state updates const bool is_inertial = ui.video_frame->layout() == nullptr; updateButtonState(true, is_inertial); + + maybe_save(); } void MainWindow::stopTracker( ) { @@ -253,10 +285,7 @@ void MainWindow::stopTracker( ) { ui.pose_display->rotateBy(0, 0, 0, 0, 0, 0); if (pProtocolDialog) - { pProtocolDialog->unregister_protocol(); - pProtocolDialog = nullptr; - } work = nullptr; libs = SelectedLibraries(); @@ -311,7 +340,7 @@ void MainWindow::set_title(const QString& game_title_) QString game_title; if (game_title_ != "") game_title = " :: " + game_title_; - QString current = QFileInfo(group::ini_pathname()).fileName(); + QString current = group::ini_filename(); setWindowTitle(QStringLiteral("TrackHat ") + const_cast<const char*>(opentrack_version) + QStringLiteral(" :: ") + current + game_title); } @@ -322,14 +351,6 @@ void MainWindow::showHeadPose() work->tracker->get_raw_and_mapped_poses(mapped, raw); display_pose(mapped, raw); - -#if 0 - if (libs.pProtocol) - { - const QString name = libs.pProtocol->game_name(); - ui.game_name->setText(name); - } -#endif } template<typename t> @@ -380,9 +401,9 @@ bool mk_window(mem<t>* place, Args... params) } } -void MainWindow::showKeyboardShortcuts() { - if (mk_window<OptionsDialog, State&>(&shortcuts_widget, *this)) - connect(shortcuts_widget.get(), SIGNAL(reload()), this, SLOT(bindKeyboardShortcuts())); +void MainWindow::show_options_dialog() { + if (mk_window<OptionsDialog, State&>(&options_widget, static_cast<State&>(*this))) + connect(options_widget.get(), SIGNAL(reload()), this, SLOT(reload_options())); } void MainWindow::showCurveConfiguration() { @@ -393,40 +414,26 @@ void MainWindow::exit() { QCoreApplication::exit(0); } -QString MainWindow::remove_app_path(const QString full_path) -{ - QFileInfo path_info(full_path); - QString path = path_info.absolutePath(); - - QFileInfo app_path(QCoreApplication::applicationDirPath()); - QString app_prefix(app_path.absoluteFilePath()); - - if (path == app_prefix) - { - path = "."; - } - else if (path.startsWith(app_prefix + "/")) - { - path = "./" + path.mid(app_prefix.size() + 1); - } - - return path + "/" + path_info.fileName(); -} - -void MainWindow::profileSelected(int index) +void MainWindow::profileSelected(QString name) { - if (index == -1) + if (name == "" || is_refreshing_profiles) return; - + + const auto old_name = group::ini_filename(); + const auto new_name = name; + + if (old_name != new_name) { - QSettings settings(OPENTRACK_ORG); - settings.setValue (OPENTRACK_CONFIG_FILENAME_KEY, remove_app_path(QFileInfo(group::ini_pathname()).absolutePath() + "/" + - ui.iconcomboProfile->itemText(index))); - } + save(); - set_title(); + { + QSettings settings(OPENTRACK_ORG); + settings.setValue (OPENTRACK_CONFIG_FILENAME_KEY, new_name); + } - load_settings(); + set_title(); + load_settings(); + } } void MainWindow::shortcutRecentered() @@ -503,5 +510,5 @@ void MainWindow::maybe_start_profile_from_executable() void MainWindow::set_profile(const QString &profile) { QSettings settings(OPENTRACK_ORG); - settings.setValue(OPENTRACK_CONFIG_FILENAME_KEY, MainWindow::remove_app_path(profile)); + settings.setValue(OPENTRACK_CONFIG_FILENAME_KEY, profile); } diff --git a/facetracknoir/ui.h b/facetracknoir/ui.h index 2253ec80..1abd92ff 100644 --- a/facetracknoir/ui.h +++ b/facetracknoir/ui.h @@ -1,27 +1,3 @@ -/******************************************************************************* -* MainWindow This program is a private project of the some enthusiastic -* gamers from Holland, who don't like to pay much for -* head-tracking. -* -* Copyright (C) 2010 Wim Vriend (Developing) -* Ron Hendriks (Researching and Testing) -* -* Homepage -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation; either version 3 of the License, or (at your -* option) any later version. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, see <http://www.gnu.org/licenses/>. -*********************************************************************************/ - /* Copyright (c) 2014-2015, Stanislaw Halik <sthalik@misaki.pl> * Permission to use, copy, modify, and/or distribute this @@ -39,12 +15,7 @@ #include <QTimer> #include <QSystemTrayIcon> #include <QString> - -#if !defined(_WIN32) -# include "qxt-mini/QxtGlobalShortcut" -#else -# include <windows.h> -#endif +#include <QMenu> #include "ui_main.h" @@ -69,12 +40,16 @@ class MainWindow : public QMainWindow, private State mem<QSystemTrayIcon> tray; QTimer pose_update_timer; QTimer det_timer; - mem<OptionsDialog> shortcuts_widget; + QTimer config_list_timer; + 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; + QTimer save_timer; mem<dylib> current_protocol() { @@ -83,41 +58,44 @@ class MainWindow : public QMainWindow, private State void changeEvent(QEvent* e) override; - void createIconGroupBox(); void load_settings(); void updateButtonState(bool running, bool inertialp); - void fill_profile_combobox(); void display_pose(const double* mapped, const double* raw); void ensure_tray(); void set_title(const QString& game_title = QStringLiteral("")); -public slots: - void shortcutRecentered(); - void shortcutToggled(); - void shortcutZeroed(); - void bindKeyboardShortcuts(); + static bool get_new_config_name_from_dialog(QString &ret); + void set_profile(const QString& profile); + void maybe_save(); private slots: - void open(); + void _save(); void save(); - void saveAs(); void exit(); - void profileSelected(int index); + void profileSelected(QString name); void showProtocolSettings(); - void showKeyboardShortcuts(); + void show_options_dialog(); void showCurveConfiguration(); void showHeadPose(); void restore_from_tray(QSystemTrayIcon::ActivationReason); void maybe_start_profile_from_executable(); -public slots: + + void make_empty_config(); + void make_copied_config(); + void open_config_directory(); + void refresh_config_list(); + void startTracker(); void stopTracker(); + void reload_options(); +public slots: + void shortcutRecentered(); + void shortcutToggled(); + void shortcutZeroed(); public: MainWindow(); ~MainWindow(); void save_mappings(); void load_mappings(); - static QString remove_app_path(const QString full_path); static void set_working_directory(); - static void set_profile(const QString& profile); }; |