summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-09-05 17:21:44 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-09-05 17:21:44 +0200
commit2ca5ae5fc7a0bf752dc22026b627c0a3a742270b (patch)
treed90a7826563bbea3df0aefa23f75df3f457aad4a /gui
parent4f7bafa0124c3baa7b8da18806f50e6ff84fcf98 (diff)
gui/mappings: set smaller snap for XYZ splines
Reported-by: @olegiy Issue: #436
Diffstat (limited to 'gui')
-rw-r--r--gui/mapping-window.cpp92
-rw-r--r--gui/mapping-window.hpp8
2 files changed, 53 insertions, 47 deletions
diff --git a/gui/mapping-window.cpp b/gui/mapping-window.cpp
index e47fe8e5..38ea48d8 100644
--- a/gui/mapping-window.cpp
+++ b/gui/mapping-window.cpp
@@ -29,56 +29,56 @@ MapWidget::MapWidget(Mappings& m) :
void MapWidget::reload()
{
+
+ struct {
+ spline_widget* qfc;
+ Axis axis;
+ QCheckBox* checkbox;
+ bool altp;
+ } qfcs[] =
{
- struct {
- spline_widget* qfc;
- Axis axis;
- QCheckBox* checkbox;
- bool altp;
- } qfcs[] =
- {
- { 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, 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++)
+ { 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, 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++)
+ {
+ const bool altp = qfcs[i].altp;
+
+ Map& axis = m(qfcs[i].axis);
+ spline& conf = altp ? axis.spline_alt : axis.spline_main;
+ //const QString& name = altp ? axis.name2 : axis.name1;
+ //conf.set_bundle(make_bundle(name));
+ qfcs[i].qfc->setConfig(&conf);
+
+ if (altp)
{
- const bool altp = qfcs[i].altp;
-
- Map& axis = m(qfcs[i].axis);
- spline& conf = altp ? axis.spline_alt : axis.spline_main;
- //const QString& name = altp ? axis.name2 : axis.name1;
- //conf.set_bundle(make_bundle(name));
- qfcs[i].qfc->setConfig(&conf);
-
- if (altp)
- {
- spline_widget& qfc = *qfcs[i].qfc;
- connect(qfcs[i].checkbox, &QCheckBox::toggled,
- this,
- [&](bool f) -> void {qfc.setEnabled(f); qfc.force_redraw();});
- qfc.setEnabled(qfcs[i].checkbox->isChecked());
- qfc.force_redraw();
- }
-
- if (qfcs[i].axis >= 3)
- qfcs[i].qfc->set_snap(1, 5);
- else
- qfcs[i].qfc->set_snap(1, 1);
+ spline_widget& qfc = *qfcs[i].qfc;
+ connect(qfcs[i].checkbox, &QCheckBox::toggled,
+ this,
+ [&](bool f) -> void {qfc.setEnabled(f); qfc.force_redraw();});
+ qfc.setEnabled(qfcs[i].checkbox->isChecked());
+ qfc.force_redraw();
}
+
+ if (qfcs[i].axis >= 3)
+ qfcs[i].qfc->set_snap(1, 5);
+ else
+ qfcs[i].qfc->set_snap(.5, 2.5);
}
+
}
void MapWidget::closeEvent(QCloseEvent*)
diff --git a/gui/mapping-window.hpp b/gui/mapping-window.hpp
index cb589efc..7648c994 100644
--- a/gui/mapping-window.hpp
+++ b/gui/mapping-window.hpp
@@ -1,8 +1,13 @@
#pragma once
-#include <QWidget>
+
#include "logic/mappings.hpp"
#include "ui_mapping-window.h"
+#include <QWidget>
+#include <QShowEvent>
+#include <QCloseEvent>
+#include <QCheckBox>
+
class MapWidget final : public QWidget
{
Q_OBJECT
@@ -14,6 +19,7 @@ private:
Mappings& m;
main_settings s;
+
void closeEvent(QCloseEvent*) override;
void save_dialog();