Less expression evaluation for more robustness

This commit is contained in:
Matthias Koefferlein
2021-12-16 00:23:06 +01:00
parent 3ef28c8a9d
commit a6d4c80c6c
40 changed files with 267 additions and 179 deletions
@@ -242,10 +242,10 @@ void
NetTracerConfigPage::commit (lay::Dispatcher *root)
{
double dim = 1.0;
tl::from_string (tl::to_string (le_window->text ()), dim);
tl::from_string_ext (tl::to_string (le_window->text ()), dim);
unsigned int max_shapes_highlighted = 10000;
tl::from_string (tl::to_string (le_max_markers->text ()), max_shapes_highlighted);
tl::from_string_ext (tl::to_string (le_max_markers->text ()), max_shapes_highlighted);
root->config_set (cfg_nt_window_mode, lay::nt_window_type (cbx_window->currentIndex ()), NetTracerWindowModeConverter ());
root->config_set (cfg_nt_window_dim, dim);
@@ -262,7 +262,7 @@ NetTracerConfigPage::commit (lay::Dispatcher *root)
} else {
try {
int s;
tl::from_string (tl::to_string (lw_le->text ()), s);
tl::from_string_ext (tl::to_string (lw_le->text ()), s);
root->config_set (cfg_nt_marker_line_width, s);
} catch (...) { }
}
@@ -272,7 +272,7 @@ NetTracerConfigPage::commit (lay::Dispatcher *root)
} else {
try {
int s;
tl::from_string (tl::to_string (vs_le->text ()), s);
tl::from_string_ext (tl::to_string (vs_le->text ()), s);
root->config_set (cfg_nt_marker_vertex_size, s);
} catch (...) { }
}
@@ -1427,7 +1427,7 @@ NetTracerDialog::get_trace_depth()
try {
QString depth = depth_le->text ().trimmed ();
if (! depth.isEmpty ()) {
tl::from_string (tl::to_string (depth), n);
tl::from_string_ext (tl::to_string (depth), n);
if (n < 0 || n > double (std::numeric_limits<size_t>::max ())) {
n = 0.0;
}
@@ -132,7 +132,7 @@ D25View::scale_value_edited ()
{
double f = mp_ui->d25_view->scale_factor ();
try {
tl::from_string (tl::to_string (mp_ui->zoom_factor->text ()), f);
tl::from_string_ext (tl::to_string (mp_ui->zoom_factor->text ()), f);
f = std::min (1e6, std::max (1e-6, f));
} catch (...) {
// ignore exceptions
@@ -146,7 +146,7 @@ D25View::vscale_value_edited ()
{
double f = mp_ui->d25_view->vscale_factor ();
try {
tl::from_string (tl::to_string (mp_ui->vzoom_factor->text ()), f);
tl::from_string_ext (tl::to_string (mp_ui->vzoom_factor->text ()), f);
f = std::min (1e6, std::max (1e-6, f));
} catch (...) {
// ignore exceptions