From 0ce90a85fa6d657ed423171bc94320a613b53e1e Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 25 Apr 2020 14:14:13 +0200 Subject: WIP: Sync knobs to settings changes. --- plugingui/powerwidget.cc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/plugingui/powerwidget.cc b/plugingui/powerwidget.cc index 83ce2b9..fe0b68a 100644 --- a/plugingui/powerwidget.cc +++ b/plugingui/powerwidget.cc @@ -38,23 +38,14 @@ #include PowerWidget::PowerWidget(GUI::Widget* parent, - Settings& settings, - SettingsNotifier& settings_notifier) + Settings& settings, + SettingsNotifier& settings_notifier) : GUI::Widget(parent) , canvas(this, settings, settings_notifier) , settings(settings) { canvas.move(7, 7); - checkbox_enable.setChecked(settings.enable_powermap.load()); - knob0_x.setValue(settings.fixed0_x.load()); - knob0_y.setValue(settings.fixed0_y.load()); - knob1_x.setValue(settings.fixed1_x.load()); - knob1_y.setValue(settings.fixed1_y.load()); - knob2_x.setValue(settings.fixed2_x.load()); - knob2_y.setValue(settings.fixed2_y.load()); - checkbox_shelf.setChecked(settings.shelf.load()); - CONNECT(&checkbox_enable, stateChangedNotifier, this, &PowerWidget::chk_enable); CONNECT(&knob0_x, valueChangedNotifier, this, &PowerWidget::k0_x); CONNECT(&knob0_y, valueChangedNotifier, this, &PowerWidget::k0_y); @@ -72,6 +63,15 @@ PowerWidget::PowerWidget(GUI::Widget* parent, knob2_x.resize(42, 42); knob2_y.resize(42, 42); checkbox_shelf.resize(100, 42); + + CONNECT(&settings_notifier, enable_powermap, &checkbox_enable, &GUI::CheckBox::setChecked); + CONNECT(&settings_notifier, fixed0_x, &knob0_x, &GUI::Knob::setValue); + CONNECT(&settings_notifier, fixed0_y, &knob0_y, &GUI::Knob::setValue); + CONNECT(&settings_notifier, fixed1_x, &knob1_x, &GUI::Knob::setValue); + CONNECT(&settings_notifier, fixed1_y, &knob1_y, &GUI::Knob::setValue); + CONNECT(&settings_notifier, fixed2_x, &knob2_x, &GUI::Knob::setValue); + CONNECT(&settings_notifier, fixed2_y, &knob2_y, &GUI::Knob::setValue); + CONNECT(&settings_notifier, shelf, &checkbox_shelf, &GUI::CheckBox::setChecked); } void PowerWidget::chk_enable(bool v) -- cgit v1.2.3