summaryrefslogtreecommitdiffhomepage
path: root/facetracknoir
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-10-12 00:30:13 +0200
committerStanislaw Halik <sthalik@misaki.pl>2014-10-12 00:30:13 +0200
commit88f985ca34275fc1cc014c5b8fa618ca95233db7 (patch)
treefd1a2418d20a21f843b66b0cec0dc0a7aa503068 /facetracknoir
parentf50ef9ca768f676c38fb7f24c15d38e2f72126fb (diff)
spline editor needs discard changes on cancel
Diffstat (limited to 'facetracknoir')
-rw-r--r--facetracknoir/curve-config.cpp15
-rw-r--r--facetracknoir/curve-config.h5
-rw-r--r--facetracknoir/facetracknoir.cpp8
-rw-r--r--facetracknoir/facetracknoir.h2
-rw-r--r--facetracknoir/facetracknoir.ui12
-rw-r--r--facetracknoir/mappings.hpp9
6 files changed, 23 insertions, 28 deletions
diff --git a/facetracknoir/curve-config.cpp b/facetracknoir/curve-config.cpp
index 886e40fa..57cea7a4 100644
--- a/facetracknoir/curve-config.cpp
+++ b/facetracknoir/curve-config.cpp
@@ -1,7 +1,8 @@
#include "./facetracknoir.h"
#include "./curve-config.h"
#include "./main-settings.hpp"
-CurveConfigurationDialog::CurveConfigurationDialog(Mappings& m, main_settings& s, QWidget *parent) : QWidget(parent, Qt::Dialog),
+MapWidget::MapWidget(Mappings& m, main_settings& s, QWidget *parent) :
+ QWidget(parent, Qt::Dialog),
m(m)
{
ui.setupUi( this );
@@ -82,16 +83,12 @@ CurveConfigurationDialog::CurveConfigurationDialog(Mappings& m, main_settings& s
tie_setting(s.a_z.src, ui.src_z);
}
-void CurveConfigurationDialog::doOK() {
- save();
+void MapWidget::doOK() {
+ m.save_mappings();
this->close();
}
-void CurveConfigurationDialog::doCancel() {
- m.load_mappings();
+void MapWidget::doCancel() {
+ m.invalidate_unsaved();
this->close();
}
-
-void CurveConfigurationDialog::save() {
- m.save_mappings();
-}
diff --git a/facetracknoir/curve-config.h b/facetracknoir/curve-config.h
index 67a588e2..d485c4ff 100644
--- a/facetracknoir/curve-config.h
+++ b/facetracknoir/curve-config.h
@@ -3,15 +3,14 @@
#include "./mappings.hpp"
#include "ui_ftnoir_curves.h"
-class CurveConfigurationDialog: public QWidget
+class MapWidget: public QWidget
{
Q_OBJECT
public:
- CurveConfigurationDialog(Mappings &m, main_settings &s, QWidget *parent );
+ MapWidget(Mappings &m, main_settings &s, QWidget *parent );
private:
Ui::UICCurveConfigurationDialog ui;
Mappings& m;
- void save();
private slots:
void doOK();
void doCancel();
diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp
index af76f09b..f689cb5f 100644
--- a/facetracknoir/facetracknoir.cpp
+++ b/facetracknoir/facetracknoir.cpp
@@ -91,7 +91,7 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent) : QMainWindow(parent),
pProtocolDialog(nullptr),
pFilterDialog(nullptr),
shortcuts_widget(nullptr),
- mapping_widget(new CurveConfigurationDialog(pose, s, this)),
+ mapping_widget(nullptr),
kbd_quit(QKeySequence("Ctrl+Q"), this),
looping(0),
video_frame_layout(new QVBoxLayout()),
@@ -444,8 +444,10 @@ void FaceTrackNoIR::showKeyboardShortcuts() {
shortcuts_widget->raise();
}
void FaceTrackNoIR::showCurveConfiguration() {
- if (!mapping_widget)
- mapping_widget = new CurveConfigurationDialog(pose, s, this);
+ if (mapping_widget)
+ delete mapping_widget;
+
+ mapping_widget = new MapWidget(pose, s, this);
mapping_widget->show();
mapping_widget->raise();
diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h
index 09f96147..d4c3a369 100644
--- a/facetracknoir/facetracknoir.h
+++ b/facetracknoir/facetracknoir.h
@@ -100,7 +100,7 @@ private:
IFilterDialog* pFilterDialog;
QWidget *shortcuts_widget;
- CurveConfigurationDialog* mapping_widget;
+ MapWidget* mapping_widget;
void createIconGroupBox();
void loadSettings();
diff --git a/facetracknoir/facetracknoir.ui b/facetracknoir/facetracknoir.ui
index 1d769f0d..41c6abc9 100644
--- a/facetracknoir/facetracknoir.ui
+++ b/facetracknoir/facetracknoir.ui
@@ -435,12 +435,6 @@
</property>
<item row="0" column="0">
<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>
@@ -458,12 +452,6 @@
</item>
<item row="1" column="0">
<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>Keys</string>
</property>
diff --git a/facetracknoir/mappings.hpp b/facetracknoir/mappings.hpp
index a3e53450..5953ed1e 100644
--- a/facetracknoir/mappings.hpp
+++ b/facetracknoir/mappings.hpp
@@ -76,4 +76,13 @@ public:
axes[i].curveAlt.saveSettings(iniFile, axes[i].name2);
}
}
+
+ void invalidate_unsaved()
+ {
+ for (int i = 0; i < 6; i++)
+ {
+ axes[i].curve.invalidate_unsaved_settings();
+ axes[i].curveAlt.invalidate_unsaved_settings();
+ }
+ }
};