summaryrefslogtreecommitdiffhomepage
path: root/facetracknoir
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-07-04 09:19:39 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-07-04 09:29:28 +0200
commitf58efb5c2c51e5866d4640036865792b822641f6 (patch)
tree4316d898c27c3adb1c332544876445ba73bd1eb0 /facetracknoir
parent27bbb01ff3d49bd37daa9649f5c2320663c46aa4 (diff)
parent0bf534ff329cabaa61a0dddb8671827577407aba (diff)
Merge branch 'unstable' into trackhat-ui
Diffstat (limited to 'facetracknoir')
-rw-r--r--facetracknoir/main.cpp12
-rw-r--r--facetracknoir/options-dialog.cpp9
-rw-r--r--facetracknoir/process_detector.cpp11
-rw-r--r--facetracknoir/settings.ui224
-rw-r--r--facetracknoir/ui.cpp25
5 files changed, 166 insertions, 115 deletions
diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp
index c92f6980..6d29e3b5 100644
--- a/facetracknoir/main.cpp
+++ b/facetracknoir/main.cpp
@@ -20,7 +20,7 @@ static void add_program_library_path()
{
char* p = _pgmptr;
{
- char path[MAX_PATH];
+ char path[MAX_PATH+1];
strcpy(path, p);
char* ptr = strrchr(path, '\\');
if (ptr)
@@ -77,13 +77,17 @@ int main(int argc, char** argv)
if (use_profile)
MainWindow::set_profile(profile);
- MainWindow w;
+ auto w = std::make_shared<MainWindow>();
if (use_profile)
- w.startTracker();
+ w->startTracker();
- w.show();
+ w->show();
app.exec();
+ // on MSVC crashes in atexit
+#ifdef _MSC_VER
+ TerminateProcess(GetCurrentProcess(), 0);
+#endif
return 0;
}
diff --git a/facetracknoir/options-dialog.cpp b/facetracknoir/options-dialog.cpp
index 0fe90c93..1b64de9e 100644
--- a/facetracknoir/options-dialog.cpp
+++ b/facetracknoir/options-dialog.cpp
@@ -81,6 +81,15 @@ OptionsDialog::OptionsDialog(State& state) : state(state), trans_calib_running(f
tie_setting(acc.rot_deadzone, ui.rot_dz_slider);
tie_setting(acc.trans_deadzone, ui.trans_dz_slider);
+ update_rot_display(ui.rotation_slider->value());
+ update_trans_display(ui.translation_slider->value());
+ update_ewma_display(ui.ewma_slider->value());
+ update_rot_dz_display(ui.rot_dz_slider->value());
+ update_trans_dz_display(ui.trans_dz_slider->value());
+
+ tie_setting(pt.dynamic_pose, ui.dynamic_pose);
+ tie_setting(pt.init_phase_timeout, ui.init_phase_timeout);
+
connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info()));
connect( ui.tcalib_button,SIGNAL(toggled(bool)), this,SLOT(startstop_trans_calib(bool)) );
diff --git a/facetracknoir/process_detector.cpp b/facetracknoir/process_detector.cpp
index 237d350d..8efc0c10 100644
--- a/facetracknoir/process_detector.cpp
+++ b/facetracknoir/process_detector.cpp
@@ -9,25 +9,25 @@
void settings::set_game_list(const QString &game_list)
{
- QSettings settings(group::org);
+ QSettings settings(OPENTRACK_ORG);
settings.setValue("executable-list", game_list);
}
QString settings::get_game_list()
{
- QSettings settings(group::org);
+ QSettings settings(OPENTRACK_ORG);
return settings.value("executable-list").toString();
}
bool settings::is_enabled()
{
- QSettings settings(group::org);
+ QSettings settings(OPENTRACK_ORG);
return settings.value("executable-detector-enabled", false).toBool();
}
void settings::set_is_enabled(bool enabled)
{
- QSettings settings(group::org);
+ QSettings settings(OPENTRACK_ORG);
settings.setValue("executable-detector-enabled", enabled);
}
@@ -68,6 +68,7 @@ int process_detector::add_row(QString exe_name, QString profile)
QComboBox* cb = new QComboBox();
cb->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum);
+ cb->addItem("");
cb->addItems(group::ini_list());
ui.tableWidget->setCellWidget(i, 1, cb);
@@ -222,7 +223,7 @@ bool process_detector_worker::config_to_start(QString& str)
{
last_exe_name = name;
str = filenames[name];
- return true;
+ return str != "";
}
}
diff --git a/facetracknoir/settings.ui b/facetracknoir/settings.ui
index efe1568a..b41c09a0 100644
--- a/facetracknoir/settings.ui
+++ b/facetracknoir/settings.ui
@@ -297,20 +297,7 @@
<string>Camera</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_9">
- <item row="4" column="0">
- <spacer name="verticalSpacer_2">
- <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="2" column="0">
+ <item row="3" column="0">
<widget class="QGroupBox" name="groupBox_6">
<property name="title">
<string>Point extraction</string>
@@ -424,6 +411,124 @@
</layout>
</widget>
</item>
+ <item row="4" column="0">
+ <widget class="QGroupBox" name="groupBox_11">
+ <property name="title">
+ <string>Status</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="caminfo_label">
+ <property name="text">
+ <string>Not running</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="pointinfo_label">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QGroupBox" name="groupBox_9">
+ <property name="title">
+ <string>Device</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_32">
+ <property name="text">
+ <string>Dynamic pose resolution</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="dynamic_pose">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="camera_mode">
+ <item>
+ <property name="text">
+ <string>640x480, 75 Hz</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>640x480, 60 Hz</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>320x240, 189 Hz</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>320x240, 120 Hz</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_25">
+ <property name="text">
+ <string>Mode</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QComboBox" name="camera_fov">
+ <item>
+ <property name="text">
+ <string>56°</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>75°</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Field of view</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_33">
+ <property name="text">
+ <string>Dynamic pose timeout</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QSpinBox" name="init_phase_timeout">
+ <property name="suffix">
+ <string> ms</string>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>10000</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_5">
<property name="title">
@@ -530,89 +635,18 @@
</layout>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QGroupBox" name="groupBox_9">
- <property name="title">
- <string>Device</string>
+ <item row="5" column="0">
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
</property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label_25">
- <property name="text">
- <string>Mode</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QComboBox" name="camera_mode">
- <item>
- <property name="text">
- <string>640x480, 75 Hz</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>640x480, 60 Hz</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>320x240, 189 Hz</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>320x240, 120 Hz</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Field of view</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QComboBox" name="camera_fov">
- <item>
- <property name="text">
- <string>56°</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>75°</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QGroupBox" name="groupBox_11">
- <property name="title">
- <string>Status</string>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="caminfo_label">
- <property name="text">
- <string>Not running</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="pointinfo_label">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
+ </spacer>
</item>
</layout>
</widget>
diff --git a/facetracknoir/ui.cpp b/facetracknoir/ui.cpp
index c646808c..8cf14050 100644
--- a/facetracknoir/ui.cpp
+++ b/facetracknoir/ui.cpp
@@ -102,8 +102,8 @@ void MainWindow::open() {
if (! fileName.isEmpty() ) {
{
- QSettings settings(group::org);
- settings.setValue(group::filename_key, remove_app_path(fileName));
+ QSettings settings(OPENTRACK_ORG);
+ settings.setValue(OPENTRACK_CONFIG_FILENAME_KEY, remove_app_path(fileName));
}
fill_profile_combobox();
load_settings();
@@ -151,8 +151,8 @@ void MainWindow::saveAs()
{
(void) QFile::copy(oldFile, fileName);
- QSettings settings(group::org);
- settings.setValue (group::filename_key, remove_app_path(fileName));
+ QSettings settings(OPENTRACK_ORG);
+ settings.setValue (OPENTRACK_CONFIG_FILENAME_KEY, remove_app_path(fileName));
}
save();
@@ -203,14 +203,11 @@ void MainWindow::bindKeyboardShortcuts()
void MainWindow::startTracker() {
s.b->save();
load_settings();
- bindKeyboardShortcuts();
// tracker dtor needs run first
work = nullptr;
libs = SelectedLibraries(ui.video_frame, std::make_shared<Tracker_PT>(), current_protocol(), std::make_shared<FTNoIR_Filter>());
-
- work = std::make_shared<Work>(s, pose, libs, this, winId());
{
double p[6] = {0,0,0, 0,0,0};
@@ -223,9 +220,14 @@ void MainWindow::startTracker() {
"One of libraries failed to load. Check installation.",
QMessageBox::Ok,
QMessageBox::NoButton);
+ libs = SelectedLibraries();
return;
}
+ work = std::make_shared<Work>(s, pose, libs, this, winId());
+
+ bindKeyboardShortcuts();
+
if (pProtocolDialog)
pProtocolDialog->register_protocol(libs.pProtocol.get());
@@ -329,6 +331,7 @@ void MainWindow::showProtocolSettings() {
} else
{
auto dialog = mk_dialog<IProtocolDialog>(current_protocol());
+ if (!dialog) return;
pProtocolDialog = dialog;
if (libs.pProtocol != nullptr)
dialog->register_protocol(libs.pProtocol.get());
@@ -397,8 +400,8 @@ void MainWindow::profileSelected(int index)
return;
{
- QSettings settings(group::org);
- settings.setValue (group::filename_key, remove_app_path(QFileInfo(group::ini_pathname()).absolutePath() + "/" +
+ QSettings settings(OPENTRACK_ORG);
+ settings.setValue (OPENTRACK_CONFIG_FILENAME_KEY, remove_app_path(QFileInfo(group::ini_pathname()).absolutePath() + "/" +
ui.iconcomboProfile->itemText(index)));
}
load_settings();
@@ -477,6 +480,6 @@ void MainWindow::maybe_start_profile_from_executable()
void MainWindow::set_profile(const QString &profile)
{
- QSettings settings(group::org);
- settings.setValue(group::filename_key, MainWindow::remove_app_path(profile));
+ QSettings settings(OPENTRACK_ORG);
+ settings.setValue(OPENTRACK_CONFIG_FILENAME_KEY, MainWindow::remove_app_path(profile));
}