summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-02-05 11:49:06 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-02-05 11:49:06 +0100
commit87d2b5992d400239240709adc6503e500ea7e058 (patch)
tree861592d4a49b28b0084bf8162044cb0b77e6ef86
parent6a28df861112ae4de4d901c6f1bfa49daffde4a7 (diff)
gui, logic: allow for limiting max X on translation axis also
-rw-r--r--gui/mapping-window.cpp13
-rw-r--r--gui/mapping-window.ui114
-rw-r--r--logic/main-settings.hpp26
3 files changed, 142 insertions, 11 deletions
diff --git a/gui/mapping-window.cpp b/gui/mapping-window.cpp
index 7e5ad6e3..05ccddda 100644
--- a/gui/mapping-window.cpp
+++ b/gui/mapping-window.cpp
@@ -55,12 +55,15 @@ void MapWidget::load()
{ nullptr, Yaw, nullptr, false }
};
+ using a = axis_opts::max_clamp;
+
for (QComboBox* x : { ui.max_yaw_rotation, ui.max_pitch_rotation, ui.max_roll_rotation })
- {
- using a = axis_opts::max_rotation;
- for (a y : { a::r180, a::r90, a::r60, a::r45, a::r30, a::r20 })
+ for (a y : { a::r180, a::r90, a::r60, a::r45, a::r30, a::r25, a::r20, a::r15, a::r10 })
x->addItem(QString::number(y) + "°", y);
- }
+
+ for (QComboBox* x : { ui.max_x_translation, ui.max_y_translation, ui.max_z_translation })
+ for (a y : { a::t30, a::t20, a::t15, a::t10 })
+ x->addItem(QStringLiteral("%1 mm").arg(int(y)), y);
for (int i = 0; qfcs[i].qfc; i++)
{
@@ -76,7 +79,7 @@ void MapWidget::load()
static_cast<void(base_value::*)(bool) const>(&base_value::valueChanged),
this,
[&](bool f) -> void {qfc.setEnabled(f); qfc.force_redraw();});
- qfc.setEnabled(qfcs[i].checkbox->isChecked());
+ qfc.setEnabled(axis.opts.altp);
qfc.force_redraw();
}
diff --git a/gui/mapping-window.ui b/gui/mapping-window.ui
index dc43ab8a..befa0194 100644
--- a/gui/mapping-window.ui
+++ b/gui/mapping-window.ui
@@ -315,6 +315,44 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
+ <widget class="QFrame" name="frame444">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout444">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Max translation</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="max_x_translation">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
<widget class="spline_widget" name="txconfig" native="true">
<property name="colorBezier" stdset="0">
<color>
@@ -365,6 +403,44 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
+ <widget class="QFrame" name="frame555">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout555">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Max translation</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="max_y_translation">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
<widget class="spline_widget" name="tyconfig" native="true">
<property name="colorBezier" stdset="0">
<color>
@@ -415,6 +491,44 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
+ <widget class="QFrame" name="frame666">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout666">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Max translation</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="max_z_translation">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
<widget class="spline_widget" name="tzconfig" native="true">
<property name="colorBezier" stdset="0">
<color>
diff --git a/logic/main-settings.hpp b/logic/main-settings.hpp
index 504952ff..f87cc789 100644
--- a/logic/main-settings.hpp
+++ b/logic/main-settings.hpp
@@ -16,16 +16,29 @@ using namespace options;
#include "export.hpp"
+namespace axis_clamp_opts
+{
+
+} // ns axis-clamp-opts
+
struct axis_opts final
{
- enum max_rotation : int
+ enum max_clamp
{
r180 = 180,
r90 = 90,
r60 = 60,
r45 = 45,
r30 = 30,
- r20 = 25,
+ r25 = 25,
+ r20 = 20,
+ r15 = 15,
+ r10 = 10,
+
+ t30 = 30,
+ t20 = 20,
+ t15 = 15,
+ t10 = 10,
};
// note, these two bundles can be the same value with no issues
@@ -33,15 +46,15 @@ struct axis_opts final
value<double> zero;
value<int> src;
value<bool> invert, altp;
- value<max_rotation> clamp;
- axis_opts(bundle b_settings_window, bundle b_mapping_window, QString pfx, int idx) :
+ value<max_clamp> clamp;
+ axis_opts(bundle b_settings_window, bundle b_mapping_window, QString pfx, Axis idx) :
b_settings_window(b_settings_window),
b_mapping_window(b_mapping_window),
zero(b_settings_window, n(pfx, "zero-pos"), 0),
src(b_settings_window, n(pfx, "source-index"), idx),
invert(b_settings_window, n(pfx, "invert-sign"), false),
altp(b_mapping_window, n(pfx, "alt-axis-sign"), false),
- clamp(b_mapping_window, n(pfx, "max-value"), r180)
+ clamp(b_mapping_window, n(pfx, "max-value"), idx >= Yaw ? r180 : t30)
{}
private:
static inline QString n(QString pfx, QString name)
@@ -78,7 +91,8 @@ struct module_settings
struct main_settings
{
bundle b, b_map;
- axis_opts a_x, a_y, a_z, a_yaw, a_pitch, a_roll;
+ axis_opts a_x, a_y, a_z;
+ axis_opts a_yaw, a_pitch, a_roll;
value<bool> tcomp_p, tcomp_disable_tx, tcomp_disable_ty, tcomp_disable_tz;
value<bool> tcomp_disable_src_yaw, tcomp_disable_src_pitch, tcomp_disable_src_roll;
value<bool> tray_enabled, tray_start;