summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-10-22 10:04:04 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-10-27 16:42:56 +0200
commit829bd3b164b90a68b0d73eac4a1bfa78aa520ba0 (patch)
tree42d5fd43fe668710e8ad057d6f2612aac7f52b40
parent9d3167ed3d64b242ccdee56542c4eb868d8d9b74 (diff)
gui: must close module dialogs
Otherwise settings don't get cancelled
-rw-r--r--gui/main-window.cpp9
-rw-r--r--spline/spline.cpp22
2 files changed, 29 insertions, 2 deletions
diff --git a/gui/main-window.cpp b/gui/main-window.cpp
index 40a3dcd5..64935157 100644
--- a/gui/main-window.cpp
+++ b/gui/main-window.cpp
@@ -621,18 +621,27 @@ void MainWindow::show_tracker_settings()
{
if (mk_dialog(current_tracker(), pTrackerDialog) && work && work->libs.pTracker)
pTrackerDialog->register_tracker(work->libs.pTracker.get());
+ if (pTrackerDialog)
+ // must run bundle::reload(), don't remove next line
+ QObject::connect(pTrackerDialog.get(), &ITrackerDialog::closing, this, [this]() { pTrackerDialog = nullptr; });
}
void MainWindow::show_proto_settings()
{
if (mk_dialog(current_protocol(), pProtocolDialog) && work && work->libs.pProtocol)
pProtocolDialog->register_protocol(work->libs.pProtocol.get());
+ if (pProtocolDialog)
+ // must run bundle::reload(), don't remove next line
+ QObject::connect(pProtocolDialog.get(), &IProtocolDialog::closing, this, [this]() { pProtocolDialog = nullptr; });
}
void MainWindow::show_filter_settings()
{
if (mk_dialog(current_filter(), pFilterDialog) && work && work->libs.pFilter)
pFilterDialog->register_filter(work->libs.pFilter.get());
+ if (pFilterDialog)
+ // must run bundle::reload(), don't remove next line
+ QObject::connect(pFilterDialog.get(), &IFilterDialog::closing, this, [this]() { pFilterDialog = nullptr; });
}
void MainWindow::show_options_dialog()
diff --git a/spline/spline.cpp b/spline/spline.cpp
index 1252d3ae..2e29997a 100644
--- a/spline/spline.cpp
+++ b/spline/spline.cpp
@@ -378,13 +378,31 @@ void spline::set_bundle(bundle b, const QString& axis_name, Axis axis)
double spline::max_input() const
{
QMutexLocker l(&_mutex);
- return s ? s->opts.clamp_x_.to<double>() : 0;
+ if (s)
+ {
+ using m = axis_opts::max_clamp;
+ const value<m>& clamp = s->opts.clamp_x_;
+ const QList<QPointF> points = s->points;
+ if (clamp == m::x1000 && points.size())
+ return points[points.size() - 1].x();
+ return s ? std::fabs(clamp.to<double>()) : 0;
+ }
+ return 0;
}
double spline::max_output() const
{
QMutexLocker l(&_mutex);
- return s ? std::fabs(s->opts.clamp_y_.to<double>()) : 0;
+ if (s)
+ {
+ using m = axis_opts::max_clamp;
+ const value<m>& clamp = s->opts.clamp_y_;
+ const QList<QPointF> points = s->points;
+ if (clamp == m::x1000 && points.size())
+ return points[points.size() - 1].y();
+ return s ? std::fabs(clamp.to<double>()) : 0;
+ }
+ return 0;
}
void spline::ensure_valid(QList<QPointF>& the_points)