summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2020-04-25 14:14:13 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2020-04-25 14:14:13 +0200
commit0ce90a85fa6d657ed423171bc94320a613b53e1e (patch)
treeecf91290940eba60970f2686bf3ae4f2e651da43
parent25b143c76cb87fcd95b15bff3a4ae619b2cbb98b (diff)
WIP: Sync knobs to settings changes.
-rw-r--r--plugingui/powerwidget.cc22
1 files 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 <cmath>
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)