diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-10-18 18:24:43 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-10-19 14:46:32 +0200 |
commit | ef5b07efe3517713e0343e01c806149a0a20b873 (patch) | |
tree | 1b9fabfa75c03556cfb41a99184b89f1a5bf90aa | |
parent | 88125b68dfae2dd6a913b8b84ae2c5ee0f6682ed (diff) |
filter/accela: simplify QString usage
-rw-r--r-- | filter-accela/ftnoir_filter_accela_dialog.cpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/filter-accela/ftnoir_filter_accela_dialog.cpp b/filter-accela/ftnoir_filter_accela_dialog.cpp index b861f7be..c8262dd5 100644 --- a/filter-accela/ftnoir_filter_accela_dialog.cpp +++ b/filter-accela/ftnoir_filter_accela_dialog.cpp @@ -32,7 +32,6 @@ FilterControls::FilterControls() tie_setting(s.ewma, ui.ewma_slider); tie_setting(s.rot_deadzone, ui.rot_dz_slider); tie_setting(s.trans_deadzone, ui.trans_dz_slider); - tie_setting(s.rot_nonlinearity, ui.rot_nl_slider); update_rot_display(s.rot_sensitivity); @@ -87,35 +86,43 @@ void FilterControls::save() s.b->save(); } +#define FIELD(x, a) ((a).arg(((x).cur()), 0, 'g', 4)) +#define LIT(x) QStringLiteral(x) + void FilterControls::update_rot_display(const slider_value& val) { - ui.rot_gain->setText(QString::number(val.cur()) + "°"); + static const QString str(QString::fromUtf8("%1°")); + ui.rot_gain->setText(FIELD(val, str)); } void FilterControls::update_trans_display(const slider_value& val) { - ui.trans_gain->setText(QString::number(val.cur()) + "mm"); + ui.trans_gain->setText(FIELD(val, LIT("%1mm"))); } void FilterControls::update_ewma_display(const slider_value& val) { - ui.ewma_label->setText(QString::number(val.cur()) + "ms"); + ui.ewma_label->setText(FIELD(val, LIT("%1ms"))); } void FilterControls::update_rot_dz_display(const slider_value& val) { - ui.rot_dz->setText(QString::number(val.cur()) + "°"); + static const QString str(QString::fromUtf8("%1°")); + ui.rot_dz->setText(FIELD(val, str)); } void FilterControls::update_trans_dz_display(const slider_value& val) { - ui.trans_dz->setText(QString::number(val.cur()) + "mm"); + ui.trans_dz->setText(FIELD(val, LIT("%1mm"))); } -void FilterControls::update_rot_nl_slider(const slider_value& sl) +void FilterControls::update_rot_nl_slider(const slider_value& val) { - ui.rot_nl->setText("<html><head/><body><p>x<span style='vertical-align:super;'>" + - QString::number(sl.cur()) + - "</span></p></body></html>"); + ui.rot_nl->setText(FIELD(val, LIT( + "<html><head/><body>" + "<p>x<span style='vertical-align:super;'>" + "%1" + "</span></p>" + "</body></html>"))); } |